2017-05-26 78 views
3

我想在Eclipse中創建簡單的maven項目。 它被創建,但在構建Workspace時它會發出錯誤。 在pom.xml中也有錯誤。在Eclipse中創建MAVEN項目時出錯(開普勒)

<project xmlns="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>com.students.app</groupId> 
    <artifactId>students-application</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <build> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-resources-plugin</artifactId> 
      <version>2.5</version> 
     </plugin> 
    </plugins> 
    </build> 
</project> 

這是我的pom.xml 我得到一個錯誤如下

Multiple annotations found at this line: 
    - Failure to transfer org.apache.maven.plugins:maven-resources- 
    plugin:pom:2.5 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-resources- 
    plugin:pom:2.5 from/to central (http://repo.maven.apache.org/maven2): 
    Connection refused: no further information to http:// 
    repo.maven.apache.org/maven2/org/apache/maven/plugins/maven- 
    resources-plugin/2.5/maven-resources-plugin-2.5.pom 
    - Plugin execution not covered by lifecycle configuration: 
    org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile 
    (execution: default-compile, phase: compile) 
    - Plugin execution not covered by lifecycle configuration: 
    org.apache.maven.plugins:maven-compiler-plugin:2.3.2:testCompile 
    (execution: default-testCompile, phase: test-compile) 
    - CoreException: Could not calculate build plan: Plugin 
    org.apache.maven.plugins:maven-compiler-plugin:2.3.2 or one of its 
    dependencies could not be resolved: Failed to read artifact descriptor for 
    org.apache.maven.plugins:maven-compiler-plugin:jar:2.3.2: 
    ArtifactResolutionException: Failure to transfer 
    org.apache.maven.plugins:maven-compiler-plugin:pom:2.3.2 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.3.2 from/to 
    central (http://repo.maven.apache.org/maven2): Connection refused: no 
    further information to http://repo.maven.apache.org/maven2/org/apache/ 
    maven/plugins/maven-compiler-plugin/2.3.2/maven-compiler- 
    plugin-2.3.2.pom 

我應該怎麼辦?

+0

你在Windows或Linux? – Freeman

+0

我在Windows上工作 – ShraddhaJ

+0

*總是*在嘗試將其導入IDE中之前,驗證是否可以從命令行構建項目。這將從一開始就消除大部分問題。現在看起來您可能需要在'〜/ .m2/settings.xml'文件中配置代理。 –

回答

3

的問題可能我一些「.lastUpdated」可能會阻止您的下載,你需要刪除「 .lastUpdated」和更新Maven項目。

找到{}用戶/。平方米/存儲庫,並刪除所有 「* .lastUpdated」 文件 您可以通過

做搜索* .lastUpdated在%USERPROFILE%.m2目錄,然後刪除的文件的Eclipse報告問題

cd %userprofile%\.m2\repository 
for /r %i in (*.lastUpdated) do del %i 

做一次更新,從Eclipse中的Maven項目。

+0

非常感謝。這非常有幫助。 – ShraddhaJ