创建Eclipse Maven项目时无法解决工件错误

时间:2017-04-30 09:54:28

标签: java eclipse maven

我正在尝试在eclipse中创建简单的maven项目。当我填写详细信息并单击完成时,会弹出以下错误。

Could not get the value for parameter encoding for plugin execution default-resources
Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: The following artifacts could not be  resolved: org.apache.maven:maven-plugin-registry:jar:2.0.6, org.apache.maven:maven-core:jar:2.0.6, org.apache.maven:maven-plugin-parameter-documenter:jar:2.0.6, org.apache.maven.reporting:maven-reporting-api:jar:2.0.6, org.apache.maven.doxia:doxia-sink-api:jar:1.0-alpha-7, org.apache.maven:maven-repository-metadata:jar:2.0.6, org.apache.maven:maven-error-diagnostics:jar:2.0.6, commons-cli:commons-cli:jar:1.0, org.apache.maven:maven-plugin-descriptor:jar:2.0.6, org.codehaus.plexus:plexus-interactivity-api:jar:1.0-alpha-4, org.apache.maven:maven-artifact:jar:2.0.6, org.apache.maven:maven-model:jar:2.0.6, org.apache.maven:maven-monitor:jar:2.0.6, org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1, junit:junit:jar:3.8.1: Failure to transfer org.apache.maven:maven-plugin-registry:jar:2.0.6 from https://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:maven-plugin-registry:jar:2.0.6 from/to central (https://repo.maven.apache.org/maven2): The operation was cancelled.    

pom.xml是:

<projectxmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">  
  <modelVersion>4.0.0</modelVersion>  
  <groupId>ODI_RightNow</groupId>  
  <artifactId>bcone.rightNow</artifactId>  
  <version>0.0.1-SNAPSHOT</version>  
</project>

我尝试使用命令提示符创建项目并成功创建。 eclipse会出现什么问题?

Eclipse版本:NEON
Maven版本:3.5.0

2 个答案:

答案 0 :(得分:0)

我找到了解决问题的方法。转到.m2文件夹并删除其下的存储库文件夹。现在更新eclipse项目,右键单击项目&gt;行家&GT;更新项目。 这解决了我的错误。但仍然怀疑这实际上是做了什么。

答案 1 :(得分:0)

@puspen如果您可以在个人笔记本电脑中成功创建但在办公室笔记本电脑中创建时遇到错误,您是否在settings.xml文件中检查了代理配置?

尝试仅使用此内容更新settings.xml文件。它在我的工作环境中起作用。

<settings>
  <proxies>
   <proxy>
      <active>true</active>
      <protocol>http</protocol>
      <host>YOUR PROXY</host> 
      <port>8080</port>
    </proxy>
  </proxies>
</settings>