2012-11-14 114 views
3

我正在使用m2e插件在eclipse中使用java maven项目。我更新了我的系统,并将我的jvm从icedtea-bin-6.1.11.4更新为icedtea-bin-6.1.11.5。 Eclipse现在在我的pom文件中输出下面的错误,并且我无法运行我的项目。我对maven和eclipse很陌生,经过一天的搜索,我仍然没有找到解决方案。eclipse中使用m2e插件Maven项目依赖错误(对于maven)

我个人认为这是某种与Eclipse(配置错误?)的问题,因为我能够得到命令行上成功的构建与mvn clean install -U。而且,即使在没有安装插件的新鲜eclipse安装中,我也会得到相同的错误。

错误:

Execution default-resources of goal org.apache.maven.plugins:maven-resources-plugin:2.5:resources failed: Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failure to transfer commons-cli:commons-cli:jar:1.0 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 commons-cli:commons-cli:jar:1.0 from/to central (http://repo.maven.apache.org/maven2): connection timed out to http://repo.maven.apache.org/maven2/commons-cli/commons-cli/1.0/commons-cli-1.0.jar (org.apache.maven.plugins:maven-resources-plugin:2.5:resources:default-resources:process-resources)

环境的详细信息。

Maven的: 的Apache Maven的2.2.1(r801777; 2009-08-06 20:16:01 + 0100) Java版本:1.6.0_24 Java主:/opt/icedtea-bin-6.1.11.5/ JRE

的Eclipse: 版本:朱诺服务发布1 版本ID:20121004-1855

插件: M2E - Maven的集成为Eclipse 1.2.0.20120903-1050 M2E - SLF4J的logback上记录(可选)1.2 .0.20120903-1050

的pom.xml

<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.test</groupId> 
    <artifactId>mf</artifactId> 
    <version>0.1-SNAPSHOT</version> 
    <packaging>jar</packaging> 

    <name>mf</name> 

    <properties> 
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
    </properties> 

    <dependencies> 
    <dependency> 
     <groupId>cc.mallet</groupId> 
     <artifactId>mallet</artifactId> 
     <version>2.0.7-RC2</version> 
    </dependency> 

    <dependency> 
     <groupId>com.googlecode.efficient-java-matrix-library</groupId> 
     <artifactId>ejml</artifactId> 
     <version>0.20</version> 
    </dependency> 

    <dependency> 
     <groupId>jfreechart</groupId> 
     <artifactId>jfreechart</artifactId> 
     <version>1.0.0</version> 
    </dependency> 
    </dependencies> 

    <build> 
    <plugins> 
     <plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-compiler-plugin</artifactId> 
     <version>2.3.2</version> 
     <configuration> 
      <source>1.6</source> 
      <target>1.6</target> 
     </configuration> 
     </plugin> 

     <plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-jar-plugin</artifactId> 
     <version>2.3.1</version> 
     <configuration> 
      <archive> 
      <manifestEntries> 
       <Main-Class>lda.TMRS</Main-Class> 
      </manifestEntries> 
      </archive> 
     </configuration> 
     </plugin> 

     <plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-shade-plugin</artifactId> 
     <version>1.7</version> 
     <executions> 
      <execution> 
      <id>shade</id> 
      <goals> 
       <goal>shade</goal> 
      </goals> 
      </execution> 
     </executions> 
     </plugin> 
    </plugins> 
    </build> 

</project> 

有谁知道如何摆脱这种错误的有什么建议?

+0

在Eclipse中你使用Maven 3已通过m2e插件,但在命令行上使用Maven 2.2.1。我建议在命令行上升级到Maven 3。 – khmarbaise

回答

4

您已在本地存储库中缓存文件。请参阅:
Failure to transfer commons-cli:commons-cli:jar:1.0 from http://repo.maven.apache.org/maven2 was cached in the local repository

尝试删除或者$M2_HOME/repository或只能从$M2_HOME/repository提到的文件:

  • 公地CLI /公地CLI *
+0

我从插件库中删除了〜/ .m2/repository/commons-cli目录,并且它全部重新运行! 我以为eclipse使用我的操作系统版本(2.2.1)。当你解释它时,这一切都有意义。非常感谢! – suxumuxu