java Maven 运行错误“maven-clean-plugin:2.5 或其依赖项之一无法解析”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29092473/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-02 14:40:53  来源:igfitidea点击:

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

javamavensvnintellij-ideamaven-clean-plugin

提问by Tayfun Ya?ar

Using ?ntelliJIdea, I Downloaded my project from Subversion for 12 times.

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

Deleted .m2/repository for 7-8 times.

删除 .m2/repository 7-8 次。

Reimported, downloaded source for 15 times. Tried every possibilities but still cannot run my project.

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

Here is my Maven run profile and project hierarchy

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

project hiyerarchy

项目层次结构

and here this is my maven output

这是我的 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]

[错误] 插件 org.apache.maven.plugins:maven-clean-plugin:2.5 或其依赖项之一无法解析:无法在离线模式下访问中心 ( https://repo.maven.apache.org/maven2)并且之前没有从它下载神器 org.apache.maven.plugins:maven-clean-plugin:jar:2.5。-> [帮助 1]

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

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

There is nothing wrong with project or maven files. I'm running it on my work computer. But not in my personel.

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

Update1: After I deleted "-o" parameter in maven run configuration. Here is my new log Logs after deletig "-o" paramterand here is image url http://i.hizliresim.com/Lp6dDJ.png

更新 1:在 maven 运行配置中删除“-o”参数后。这是我删除“-o”参数后的新日志日志,这里是图像 url http://i.hizliresim.com/Lp6dDJ.png

Update2: I run this command on cmd, C:\MAYA\MAD4>mvn dependency:tree -Dverbosethe result is success. And also saw C:\Users\tayfuny\.m2\repository\org\codehaus\plexus\plexus-digest\1.0\plexus-di??gest-1.0.jarin my dir. Here is latest maven output http://i.hizliresim.com/XBgD07.png

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

回答by JBA

Update:Its early in the morning here in Switzerland - i have overseen you specified the -oparameter in your run configuration in the section Command line:. This is the console parameter to let Maven work offline ;) Remove it and you should be all good. Source: http://books.sonatype.com/mvnref-book/reference/running-sect-options.html

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

Update 2:Alright the initial problem is solved - your log however shows two more things to fix (one of them optionally but very recomended): 1.) The warnings at the very start of the build imply you have duplicate dependency/version declarations - those should be easy fixable. You can for example use mvn dependency:tree -Dverboseto get a overview on the duplicates (and which definition takes place in the end). The second is a actuall build error. I dont know about the install plugin you are using but i guess that you are missing this dependency: http://mvnrepository.com/artifact/org.codehaus.plexus/plexus-digest/1.0(or another one containing the class that could not be found - adjust version as needed as well).

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

Answer regarding offline mode:

关于离线模式的回答:

Remove the parameter -owhen running maven unless you want to work in offline mode and with your local repository only.

-o除非您想在离线模式下工作并且仅使用本地存储库,否则在运行 maven 时删除该参数。

Another probable cause is explicitly setting Maven to work in offline mode (e.g. only consult the local repository to resolve dependencies) from within the IDE itself (which will result in calling Maven with the -oparameter behind the scenes).

另一个可能的原因是从 IDE 本身内显式设置 Maven 以在离线模式下工作(例如,仅咨询本地存储库以解决依赖关系)(这将导致在-o幕后使用参数调用 Maven )。

General Settings/ Project Settings:

常规设置/项目设置:

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

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

(The very first option Work offlineshould be deactivated/ deselected unless you realy want to work with the local repository only).

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

Those settings are inherited by Maven-run configurations by default but may be overwritten at two levels

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

Default Run Configuration:

默认运行配置:

enter image description here(Those default configs will be inherited by specific run configurations. Note that changes to the general settings apply to newly created run configurations only and will not be populated to existing ones).

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

Specific Run Configuration:enter image description here

具体运行配置:在此处输入图片说明

Make sure none of the options is selected. In the end if you use a specific launch configuration make sure the option is not selected in that specific configuration and change the higher levels for convenience if it makes sence)

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