Maven 运行 错误 "maven-clean-plugin:2.5 or one of its dependencies could not be resolved"

Maven Run Error "maven-clean-plugin:2.5 or one of its dependencies could not be resolved"

使用 İntelliJIdea,我从 Subversion 下载了我的项目 12 次。

已删除 .m2/repository 7-8 次。

重新导入,下载源15次。尝试了所有可能性,但仍然无法 运行 我的项目。

这是我的 Maven 运行 配置文件和项目层次结构

这是我的 Maven 输出

[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Cannot access central (https://repo.maven.apache.org/maven2) in offline mode and the artifact org.apache.maven.plugins:maven-clean-plugin:jar:2.5 has not been downloaded from it before. -> [Help 1]

http://paste.ubuntu.com/10613835/

项目或maven文件都没有问题。我正在 运行 在我的工作计算机上安装它。但不是我个人。

Update1: 在我删除maven 运行 配置中的“-o”参数后。这是我的新日志Logs after deletig "-o" paramter and here is image url http://i.hizliresim.com/Lp6dDJ.png

Update2: 我在 cmd 上 运行 这个命令, C:\MAYA\MAD4>mvn dependency:tree -Dverbose结果成功。并且还在我的目录中看到了 C:\Users\tayfuny\.m2\repository\org\codehaus\plexus\plexus-digest.0\plexus-di‌​gest-1.0.jar。这是最新的 Maven 输出 http://i.hizliresim.com/XBgD07.png

更新:现在是瑞士的清晨 - 我已经监督了您在 运行 配置中指定的 -o 参数Command line:。这是让 Maven 离线工作的控制台参数 ;) 删除它,你应该一切都好。资料来源:http://books.sonatype.com/mvnref-book/reference/running-sect-options.html

更新 2: 好的,最初的问题已解决 - 但是您的日志显示了另外两件事需要解决(其中一个是可选的,但非常推荐):1.) 警告构建的一开始就意味着您有重复的 dependency/version 声明 - 这些应该很容易修复。例如,您可以使用 mvn dependency:tree -Dverbose 来了解重复项(以及最后发生的定义)。第二个是实际构建错误。我不知道您正在使用的安装插件,但我猜您缺少此依赖项:http://mvnrepository.com/artifact/org.codehaus.plexus/plexus-digest/1.0(或另一个包含无法找到的 class 的依赖项 - 根据需要调整版本)。

关于离线模式的回答:

在 运行ning maven 时删除参数 -o 除非你想在离线模式下工作并且只使用你的本地存储库。

另一个可能的原因是从 IDE 本身(这将导致使用 -o 幕后参数).

常规设置/项目设置:

File -> Settings -> Build, Execution, Deployment -> Build Tools -> Maven

(第一个选项 Work offline 应该停用/取消选择,除非您真的只想使用本地存储库)。

这些设置默认由 Maven-运行 配置继承,但可能会在两个级别上被覆盖

默认运行配置:

(这些默认配置将由特定 运行 配置继承。请注意,对常规设置的更改仅适用于新创建的 运行 配置,不会填充到现有配置)。

具体运行配置:

确保选择 none 个选项。最后,如果您使用特定的启动配置,请确保未在该特定配置中选择该选项,并在有意义的情况下更改更高级别以方便使用)

简单的方法

这应该适用于所有类似的错误。

这是错误的样子

  • Could not resolve : org.apache.maven.plugins:maven-clean-plugin:jar:2.5

  • Could not resolve : (groupID):(artifactID):version

所以您真正需要的是正确版本的 clean 插件。

<dependency>
  <groupId>(groupId)</groupId>
  <artifactId>(artifactId)</artifactId>
  <version>(version)</version>
  <type>maven-plugin</type>
</dependency>

This will become something like this. Add this to dependencies section Pom.xml. Reload build.

<dependency>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-surefire-plugin</artifactId>
  <version>3.0.0-M5</version>
  <type>maven-plugin</type>
</dependency> 

重新加载构建 IDE 将自动下载这些版本的工件和 如果有其他版本,请替换,因为您的项目需要这些特定版本才能 运行.

对其他依赖错误执行相同的操作。 “每次都有效”。