未能执行目标 org.apache.maven.plugins:maven-resources-plugin:2.5:resources

Posted

技术标签:

【中文标题】未能执行目标 org.apache.maven.plugins:maven-resources-plugin:2.5:resources【英文标题】:Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.5:resources 【发布时间】:2014-05-21 13:26:58 【问题描述】:

我正在使用带有 Maven 插件的 Maven 3.0.5 和 Spring Tool Source 3.2 安装。当我尝试执行“运行方式---> Maven 安装”时,我得到了 以下错误:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.5:resources (default-resources) on project mavencxf: Execution default-resources of goal org.apache.maven.plugins:maven-resources-plugin:2.5:resources failed: A required class was missing while executing org.apache.maven.plugins:maven-resources-plugin:2.5:resources: org/codehaus/plexus/util/Scanner
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.apache.maven.plugins:maven-resources-plugin:2.5
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/Users/Mindbowser-MB/.m2/repository/org/apache/maven/plugins/maven-resources-plugin/2.5/maven-resources-plugin-2.5.jar
[ERROR] urls[1] = file:/C:/Users/Mindbowser-MB/.m2/repository/org/apache/maven/reporting/maven-reporting-api/2.0.6/maven-reporting-api-2.0.6.jar
[ERROR] urls[2] = file:/C:/Users/Mindbowser-MB/.m2/repository/org/apache/maven/doxia/doxia-sink-api/1.0-alpha-7/doxia-sink-api-1.0-alpha-7.jar
[ERROR] urls[3] = file:/C:/Users/Mindbowser-MB/.m2/repository/commons-cli/commons-cli/1.0/commons-cli-1.0.jar
[ERROR] urls[4] = file:/C:/Users/Mindbowser-MB/.m2/repository/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-4/plexus-interactivity-api-1.0-alpha-4.jar
[ERROR] urls[5] = file:/C:/Users/Mindbowser-MB/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar
[ERROR] urls[6] = file:/C:/Users/Mindbowser-MB/.m2/repository/org/codehaus/plexus/plexus-utils/2.0.5/plexus-utils-2.0.5.jar
[ERROR] urls[7] = file:/C:/Users/Mindbowser-MB/.m2/repository/org/apache/maven/shared/maven-filtering/1.0/maven-filtering-1.0.jar
[ERROR] urls[8] = file:/C:/Users/Mindbowser-MB/.m2/repository/org/sonatype/plexus/plexus-build-api/0.0.4/plexus-build-api-0.0.4.jar
[ERROR] urls[9] = file:/C:/Users/Mindbowser-MB/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.13/plexus-interpolation-1.13.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
[ERROR] 
[ERROR] -----------------------------------------------------: org.codehaus.plexus.util.Scanner
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 

【问题讨论】:

听起来可能是您的 Maven 安装之间的不匹配。检查 Eclipse 中的 Maven 设置。 mvn install 是否在命令行上工作。如果没有, mvn -e install 提供什么。 除了上述检查你为什么使用旧版本的 maven-resources-plugin。 【参考方案1】:

A required class was missing while executing org.apache.maven.plugins:maven-resources-plugin:2.5:resources: org/codehaus/plexus/util/Scanner

资源插件缺少依赖项;但它应该会自动下载,...您是否处于 离线 模式?如果你上线一次并执行它,它应该会自动下载缺少的依赖项。

【讨论】:

【参考方案2】:

我的问题在于 POM.XML 文件中定义的存储库。我删除了它们,以便它使用默认存储库并解决了我的问题。

【讨论】:

【参考方案3】:

当存储库出现问题时,我曾经发生过这种情况,然后即使我再次运行 maven,它仍然失败。

解决方案

    删除maven repo ~/.m2/repository 然后重新构建

它对我有用。

【讨论】:

以上是关于未能执行目标 org.apache.maven.plugins:maven-resources-plugin:2.5:resources的主要内容,如果未能解决你的问题,请参考以下文章

未能在 GitLab CI 管道中执行目标

Spring Roo 项目。项目构建错误:未能执行目标

未能执行目标... maven-install-plugin ... 无法安装工件...(访问被拒绝)

未能执行目标 org.apache.maven.plugins:maven-enforcer-plugin

未能执行目标 maven-antrun-plugin - GitHub 操作上的连接超时

未能执行目标 org.apache.maven.plugins:maven-resources-plugin:2.5:resources