这是非常出乎意料的,我最近换了一台新机器,在设置我的开发环境时,我的一个服务在运行时出现了这个错误mvn clean install
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 04:35 min
[INFO] Finished at: 2020-11-21T22:27:09+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.coderplus.maven.plugins:copy-rename-maven-plugin:1.0:copy (copy-file) on project my-service: Execution copy-file of
goal com.coderplus.maven.plugins:copy-rename-maven-plugin:1.0:copy failed: A required class was missing while executing com.coderplus.maven.plugins:copy-renam
e-maven-plugin:1.0:copy: org/codehaus/plexus/util/Scanner
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>com.coderplus.maven.plugins:copy-rename-maven-plugin:1.0
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/Users/userName/.m2/repository/com/coderplus/maven/plugins/copy-rename-maven-plugin/1.0/copy-rename-maven-plugin-1.0.jar
[ERROR] urls[1] = file:/C:/Users/userName/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar
[ERROR] urls[2] = file:/C:/Users/userName/.m2/repository/org/apache/maven/reporting/maven-reporting-api/2.0.9/maven-reporting-api-2.0.9.jar
[ERROR] urls[3] = file:/C:/Users/userName/.m2/repository/org/apache/maven/doxia/doxia-sink-api/1.0-alpha-10/doxia-sink-api-1.0-alpha-10.jar
[ERROR] urls[4] = file:/C:/Users/userName/.m2/repository/commons-cli/commons-cli/1.0/commons-cli-1.0.jar
[ERROR] urls[5] = file:/C:/Users/userName/.m2/repository/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-4/plexus-interactivity-api-1.0-alpha-4.jar
[ERROR] urls[6] = file:/C:/Users/userName/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.8/plexus-utils-1.5.8.jar
[ERROR] urls[7] = file:/C:/Users/userName/.m2/repository/org/sonatype/plexus/plexus-build-api/0.0.7/plexus-build-api-0.0.7.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------
[ERROR] : org.codehaus.plexus.util.Scanner
我的第一个猜测是我的项目中缺少一个依赖项(不确定是哪个),尽管它确实在包括 Jenkins 实例在内的现有机器上构建成功。
我运行的其他服务都没有这样的问题。
我已经验证提到的罐子没有损坏。尝试删除整个.m2
目录并重新开始。
我在这里可能会错过任何其他可能性吗?
编辑:添加我被推荐使用较新插件的<plugins>
部分pom.xml
,但这可能有助于进一步缩小问题范围:
<plugins>
<!-- Docker Build Plugin START -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.7</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-filtering</artifactId>
<version>1.3</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>com.coderplus.maven.plugins</groupId>
<artifactId>copy-rename-maven-plugin</artifactId>
<version>1.0</version>
</plugin>
<!-- Docker Build Plugin END -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration><addResources>true</addResources></configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
我已经<execution>
从这些中删除了部分以节省一些滚动。