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

时间:2015-06-17 09:15:55

标签: java eclipse maven

我收到以下错误,我不知道为什么。我已经在多个环境中设置了我的项目并且我从来没有遇到任何问题但是最近我已经将项目添加到运行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

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

我在网上查看了这个,并尝试了下面列出的许多不同的东西来尝试解决这个问题,但它们似乎都没有用。请注意我没有使用任何代理

  • 删除.m2存储库,Maven - >更新项目......
  • 删除所有.lastUpdated个文件,Maven - >更新项目......
  • 尝试选择"强制更新快照/版本"更新项目时

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

3 个答案:

答案 0 :(得分:2)

在Eclipse中,转到Windows>偏好> Maven>用户设置

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

答案 1 :(得分:0)

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

从Maven资源库下载jar文件和pom文件并使用该命令安装它(比直接复制到文件夹更好)

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

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

答案 2 :(得分:0)

在新VM上设置项目时,我遇到了类似的错误:“ CoreException:无法计算生成计划:插件org.apache.maven.plugins:maven-compiler-plugin:2.5.1或其依赖项之一无法解决:无法读取org.apache.maven.plugins:maven-compiler-plugin:jar:2.5.1的工件描述符:ArtifactResolutionException:无法传输org.apache.maven.plugins:maven-compiler-plugin:pom:来自http://repo.maven.apache.org/maven2的2.5.1已缓存在本地存储库中,直到中心的更新间隔过去或强制执行更新后,才会重新尝试解析原始错误:无法传输工件org.apache.maven.plugins:maven -compiler-plugin:pom:2.5.1从/到中央(http://repo.maven.apache.org/maven2):连接超时...”

在我的情况下导致并解决此问题: 我在系统上安装了apache-maven-3.2.5,但发现 我的用户名( C:\ Users \ MyUserName.m2 )下的.M2文件夹中缺少settings.xml文件,因此在构建项目时出现上述错误

修复步骤:

步骤1:将settings.xml从 C:\ Users \ Public.m2 复制到虚拟机上我的用户名下的.m2文件夹( C:\ Users \ MyUserName.m2

Step2:使用CMD导航到项目后,请执行全新安装,以查看问题是否已解决,并且项目构建没有错误 像这样 : C:\ Selenium_Test_SetupB \ WebUatDemo> mvn全新安装

相关问题