eclipse Maven 错误:无法计算构建计划

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30887238/
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-09-19 22:42:33  来源:igfitidea点击:

Maven error : Could not calculate build plan

javaeclipsemaven

提问by Hip Hip Array

I am getting the following errors and i do not know why. I have set up my project on multiple environments and Ive never had any issue but recently i have added the project to an environment running Windows 8 with everything set up correctly (e.g. Maven... ) and i seem to be getting this issue

我收到以下错误,我不知道为什么。我已经在多个环境中设置了我的项目,我从来没有遇到过任何问题,但最近我将该项目添加到了一个运行 Windows 8 的环境中,并且一切都设置正确(例如 Maven...),我似乎遇到了这个问题

Multiple annotations found at this line:
    - Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (execution: default-compile, phase: compile)
    - Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:2.5.1:testCompile (execution: default-testCompile, phase: test-compile)
    - CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:2.5.1 or one of its dependencies could not be resolved: Failed to read 
     artifact descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:2.5.1: ArtifactResolutionException: Could not transfer artifact org.apache.maven.plugins:maven-compiler-
     plugin:pom:2.5.1 from/to central (http://repo.maven.apache.org/maven2): Address family not supported by protocol family: connect
    - CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:2.5.1 or one of its dependencies could not be resolved: Failed to read 
     artifact descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:2.5.1: ArtifactResolutionException: Failure to transfer org.apache.maven.plugins:maven-compiler-plugin:pom:2.5.1 
     from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. 
     Original error: Could not transfer artifact org.apache.maven.plugins:maven-compiler-plugin:pom:2.5.1 from/to central (http://repo.maven.apache.org/maven2): Address family not supported 
     by protocol family: connect

and

Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6
Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6

I have looked at this online and have tried numerous different things listed below to try and resolve this issue but none of them seem to work. Just to note i am not using any proxies

我在网上看过这个,并尝试了下面列出的许多不同的方法来尝试解决这个问题,但它们似乎都不起作用。只是要注意我没有使用任何代理

  • Delete .m2 repository, Maven -> Update Project...
  • Delete all .lastUpdatedfiles, Maven -> Update Project...
  • Tried selecting "Force Update of Snapshots/Releases" when updating project
  • 删除 .m2 存储库,Maven -> 更新项目...
  • 删除所有.lastUpdated文件,Maven -> 更新项目...
  • 尝试在更新项目时选择“强制更新快照/版本”

Does anyone have any other ideas on what i could try?

有没有人对我可以尝试的事情有任何其他想法?

回答by Will

In Eclipse, go to Windows > Preferences > Maven > User Settings

在 Eclipse 中,转到 Windows > 首选项 > Maven > 用户设置

In User Settings, fill in the field with the path to settings.xml> %M2_HOME%\conf(or the correct path).

在“用户设置”中,使用settings.xml> %M2_HOME%\conf(或正确路径)的路径填写该字段。

回答by test user

it seems like that your project doesn't install the dependency needed. Therefore you need to install it yourself.

您的项目似乎没有安装所需的依赖项。因此,您需要自己安装它。

Download both jar and pom files from the Maven Repository and installing it using the command (better than copying to the folder directly)

从Maven Repository下载jar和pom文件并使用命令安装(比直接复制到文件夹好)

mvn install:install-file -Dfile=<path-to-file> -DpomFile=<path-to-pomfile>

and also be sure that you have installed all the necessary repository for the project and cross verify in the .m2/repositoryfolder with the jar files

并确保您已经为项目安装了所有必要的存储库,并在.m2/repository包含 jar 文件的文件夹中进行交叉验证