0

这是非常出乎意料的,我最近换了一台新机器,在设置我的开发环境时,我的一个服务在运行时出现了这个错误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>从这些中删除了部分以节省一些滚动。

4

1 回答 1

0

You could use the much newer Wagon Maven Plugin:

Use this plugin to view and transfer resources between repositories using Maven Wagon.

with its copy goal:

Copy artifacts from one Wagon repository to another Wagon repository.

instead of the old copy-rename-maven-plugin.

Don't get confused by Wagon repository. There are simply source/target URLs and fromDir/toDir directories. Wagon supports the file: protocol.

Re: one of your comments to your question: The maven-resources-plugin:2.7 has in its POM:

    <dependency>
      <groupId>org.codehaus.plexus</groupId>
      <artifactId>plexus-utils</artifactId>
      <version>3.0.15</version>
    </dependency>

and no copy-rename-maven-plugin, of course.

于 2020-11-22T15:54:21.267 回答