maven找不到课

use*_*883 5 java maven

我继承了一个巨大的maven java项目,无法编译它.

mvn compile
Run Code Online (Sandbox Code Playgroud)

它告诉我它找不到一个类,即使它在当地的回购中.

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
Run Code Online (Sandbox Code Playgroud)

这是pom.xml片段,告诉它在哪里看:

 <dependency>
  <groupId>com.sun</groupId>
  <artifactId>tools</artifactId>
  <version>1.7</version>
 </dependency>
Run Code Online (Sandbox Code Playgroud)

当然,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文件夹返回到我的本地仓库,所以我知道远程仓库的连接性很好.

为什么不能找到它?

use*_*883 1

需要将其添加到 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>
Run Code Online (Sandbox Code Playgroud)

现在看起来像这样:

<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>
Run Code Online (Sandbox Code Playgroud)

然后从 8 降级到 java 7。