问题描述
我继承了一个庞大的maven java项目,无法对其进行编译.
mvn compile
它告诉我即使在本地存储库中也找不到该类.
Failed to execute goal org.codehaus.enunciate:maven-enunciate-plugin:1.25:assemble (default) on project VCWH_Core_QueryService: Execution default of goal org.codehaus.enunciate:maven-enunciate-plugin:1.25:assemble failed: A required class was missing while executing org.codehaus.enunciate:maven-enunciate-plugin:1.25:assemble: com/sun/mirror/apt/AnnotationProcessorFactory
这是pom.xml代码段,告诉它在哪里看:
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.7</version>
</dependency>
可以肯定的是,tools-1.7.jar和tools-1.7.pom位于本地存储库中,
\.m2\repository\com\sun\tools\1.7
如果我看着里面的瓶子jar tf tools-1.7.jar
我可以看到 类别
com/sun/mirror/apt/AnnotationProcessorFactory.class
我还删除了本地存储库中的sun文件夹,并在NetBeans中进行了清理并构建",并看着sun文件夹回到了本地存储库中,因此我知道与远程存储库的连接很好. >
为什么找不到它?
需要将其添加到maven-uncunciate-plugin:
<dependencies>
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.7</version>
<scope>system</scope>
<systemPath>C:\Program Files\Java\jdk1.7.0_79\lib\tools.jar</systemPath>
<optional>true</optional>
</dependency>
</dependencies>
现在看起来像这样:
<plugin>
<groupId>org.codehaus.enunciate</groupId>
<artifactId>maven-enunciate-plugin</artifactId>
<version>1.25</version>
<configuration>
<configFile>${basedir}/src/main/webapp/WEB-INF/enunciate.xml</configFile>
<compileDebug>false</compileDebug>
<addGWTSources>false</addGWTSources>
<addActionscriptSources>false</addActionscriptSources>
</configuration>
<dependencies>
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.7</version>
<scope>system</scope>
<systemPath>C:\Program Files\Java\jdk1.7.0_79\lib\tools.jar</systemPath>
<optional>true</optional>
</dependency>
</dependencies>
<executions>
<execution>
<goals>
<goal>assemble</goal>
</goals>
</execution>
</executions>
</plugin>
然后从8降级到Java7.
I've inherited a huge maven java project and can't get it to compile.
mvn compile
Its telling me it can't find a class even though its right there in the local repo.
Failed to execute goal org.codehaus.enunciate:maven-enunciate-plugin:1.25:assemble (default) on project VCWH_Core_QueryService: Execution default of goal org.codehaus.enunciate:maven-enunciate-plugin:1.25:assemble failed: A required class was missing while executing org.codehaus.enunciate:maven-enunciate-plugin:1.25:assemble: com/sun/mirror/apt/AnnotationProcessorFactory
Here is the pom.xml snippet that tells it where to look:
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.7</version>
</dependency>
And sure enough, tools-1.7.jar and tools-1.7.pom are located in the local repo at
\.m2\repository\com\sun\tools\1.7
And if I look inside the jar withjar tf tools-1.7.jar
I can see class
com/sun/mirror/apt/AnnotationProcessorFactory.class
I also blew away the sun folder in my local repo and did a "Clean and Build" in NetBeans and watched the sun folder come back into my local repo, so I know the connectivity to the remote repo is good.
Why can't it find it?
Need to add this to the maven-enunciate-plugin:
<dependencies>
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.7</version>
<scope>system</scope>
<systemPath>C:\Program Files\Java\jdk1.7.0_79\lib\tools.jar</systemPath>
<optional>true</optional>
</dependency>
</dependencies>
Now it looks like this:
<plugin>
<groupId>org.codehaus.enunciate</groupId>
<artifactId>maven-enunciate-plugin</artifactId>
<version>1.25</version>
<configuration>
<configFile>${basedir}/src/main/webapp/WEB-INF/enunciate.xml</configFile>
<compileDebug>false</compileDebug>
<addGWTSources>false</addGWTSources>
<addActionscriptSources>false</addActionscriptSources>
</configuration>
<dependencies>
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.7</version>
<scope>system</scope>
<systemPath>C:\Program Files\Java\jdk1.7.0_79\lib\tools.jar</systemPath>
<optional>true</optional>
</dependency>
</dependencies>
<executions>
<execution>
<goals>
<goal>assemble</goal>
</goals>
</execution>
</executions>
</plugin>
And then Downgraded to java 7 from 8.
这篇关于专家找不到课程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!