简体   繁体   English

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

[英]Maven Run Error “maven-clean-plugin:2.5 or one of its dependencies could not be resolved”

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.重新导入、下载源 15 次。 Tried every possibilities but still cannot run my project.尝试了所有可能性,但仍然无法运行我的项目。

Here is my Maven run profile and project hierarchy这是我的 Maven 运行配置文件和项目层次结构

项目层次结构

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. [错误] 插件 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 之前没有从中下载过。 -> [Help 1] -> [帮助 1]

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

There is nothing wrong with project or maven files.项目或 Maven 文件没有任何问题。 I'm running it on my work computer.我正在我的工作计算机上运行它。 But not in my personel.但不是在我个人。

Update1 : After I deleted "-o" parameter in maven run configuration.更新1 :在maven运行配置中删除“-o”参数后。 Here is my new log Logs after deletig "-o" paramter and here is image url http://i.hizliresim.com/Lp6dDJ.png这是我删除“-o”参数后的新日志日志,这里是图像网址http://i.hizliresim.com/Lp6dDJ.png

Update2 : I run this command on cmd, C:\\MAYA\\MAD4>mvn dependency:tree -Dverbose the result is success. Update2 :我在 cmd 上运行这个命令, C:\\MAYA\\MAD4>mvn dependency:tree -Dverbose结果是成功的。 And also saw C:\\Users\\tayfuny\\.m2\\repository\\org\\codehaus\\plexus\\plexus-digest\\1.0\\plexus-di‌​gest-1.0.jar in my dir.并且还在我的目录中看到了C:\\Users\\tayfuny\\.m2\\repository\\org\\codehaus\\plexus\\plexus-digest\\1.0\\plexus-di‌​gest-1.0.jar Here is latest maven output http://i.hizliresim.com/XBgD07.png这是最新的 maven 输出http://i.hizliresim.com/XBgD07.png

Update: Its early in the morning here in Switzerland - i have overseen you specified the -o parameter in your run configuration in the section Command line: .更新:在瑞士的清晨 - 我已经监督您在Command line:部分的运行配置中指定了-o参数Command line: This is the console parameter to let Maven work offline ;) Remove it and you should be all good.这是让 Maven 脱机工作的控制台参数;) 删除它,你应该一切都好。 Source: http://books.sonatype.com/mvnref-book/reference/running-sect-options.html来源: 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.更新 2:好的,最初的问题已经解决了 - 但是您的日志还显示了另外两件要修复的事情(其中之一是可选的,但非常推荐):1.) 构建开始时的警告暗示您有重复的依赖项/版本声明 -这些应该很容易修复。 You can for example use mvn dependency:tree -Dverbose to get a overview on the duplicates (and which definition takes place in the end).例如,您可以使用mvn dependency:tree -Dverbose来概述重复项(以及最终发生的定义)。 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).我不知道您正在使用的安装插件,但我想您缺少此依赖项: http : //mvnrepository.com/artifact/org.codehaus.plexus/plexus-digest/1.0 (或另一个包含可以找不到 - 也根据需要调整版本)。

Answer regarding offline mode:关于离线模式的回答:

Remove the parameter -o when running maven unless you want to work in offline mode and with your local repository only.运行 maven 时删除参数-o ,除非您想在离线模式下工作并且仅使用本地存储库。

Another probable cause is explicitly setting Maven to work in offline mode (eg only consult the local repository to resolve dependencies) from within the IDE itself (which will result in calling Maven with the -o parameter behind the scenes).另一个可能的原因是从 IDE 本身内显式设置 Maven 以在离线模式下工作(例如,仅咨询本地存储库以解决依赖关系)(这将导致在幕后使用-o参数调用 Maven)。

General Settings/ Project Settings:常规设置/项目设置:

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

(The very first option Work offline should 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:默认运行配置:

在此处输入图片说明 (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:具体运行配置:在此处输入图片说明

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)最后,如果您使用特定的启动配置,请确保未在该特定配置中选择该选项,并在有意义时更改更高级别以方便使用)

EASY WAY简单的方法

This should work for all similar errors.这应该适用于所有类似的错误。

This is how an error looks like这是错误的样子

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

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

So what you actually need is a correct version of the clean plugin.所以你真正需要的是一个正确版本的干净插件。

<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> 

Reload build and IDE will automatically download these version of artefacts and replace if there are other versions because your project needs these particular versions to run.重新加载构建和 IDE 将自动下载这些版本的人工制品并替换是否有其他版本,因为您的项目需要这些特定版本才能运行。

Do the same with other dependency errors.对其他依赖错误执行相同的操作。 "Works every time". “每次都有效”。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 maven-clean-plugin或其中一个依赖项无法解决 - maven-clean-plugin or one of its dependencies could not be resolved Maven:插件 org.apache.maven.plugins:maven-clean-plugin:2.5 或其依赖项之一无法解析 - Maven : Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved Maven:无法解析插件或其依赖项之一 - Maven: Plugin or one of its dependencies could not be resolved 干净安装插件上的GAE / Maven错误“com.google.appengine:appengine-maven-plugin:1.9.18或其某个依赖项无法解析” - GAE/Maven error on clean install Plugin “com.google.appengine:appengine-maven-plugin:1.9.18 or one of its dependencies could not be resolved” Maven:插件或其依赖项之一无法解析 - Maven: Plugin or one of its dependencies could not be resolved 无法计算构建计划:插件 org.apache.maven.plugins:maven-resources-plugin:2.5 或其依赖项之一无法解析 - Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved 错误:maven-site-plugin:3.7.1 或其依赖项之一无法解析 - Error: maven-site-plugin:3.7.1 or one of its dependencies could not be resolved 插件 org.apache.maven.plugins:maven-compiler-plugin 或其依赖项之一无法解析 - Plugin org.apache.maven.plugins:maven-compiler-plugin or one of its dependencies could not be resolved 插件 org.apache.maven.plugins:maven-resources-plugin:2.6 或其依赖项之一无法解析 - Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved 插件 org.apache.maven.plugins:maven-install-plugin:2.4 或其依赖项之一无法解析 - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM