This is quite unexpected, I recently switched to a new machine and while setting up my dev environment, one of my services has been giving this error on running 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
My first guess would be that I have a dependency missing in my project(not sure which one), although it does BUILD SUCCESS on existing machines including the Jenkins instance.
None of the other services I run have an issue like this.
I've verified that the jars mentioned are not corrupt. Tried deleting the whole .m2
directory and starting again as well.
Are there any other possibilities I might be missing here?
Edit: Adding the <plugins>
section of my pom.xml
I've been recommended using a newer plugin, but this may add help narrow down the issue further:
<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>
I've removed the <execution>
part from these to save some scrolling.
You could use the much newer Wagon Maven Plugin:
with its
copy
goal:instead of the old
copy-rename-maven-plugin
.Don't get confused by Wagon repository. There are simply
source
/target
URLs andfromDir
/toDir
directories. Wagon supports thefile:
protocol.Re: one of your comments to your question: The
maven-resources-plugin:2.7
has in its POM:and no
copy-rename-maven-plugin
, of course.