本文介绍了eclipse中的Maven项目依赖错误使用m2e插件(对于maven)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用m2e插件在Eclipse中使用一个java maven项目。我更新了我的系统,我的jvm从icedtea-bin-6.1.11.4更新为icedtea-bin-6.1.11.5。 Eclipse现在在我的pom文件中输出以下错误,我无法运行我的项目。我是新来的天气和日食,经过一天的谷歌搜索,我还是没有找到解决方案。



我个人认为这是一些eclipse的一个问题(配置错误?),因为我可以在命令行上使用 mvn clean install -U 获得一个成功的构建。此外,即使在没有安装插件的新鲜eclipse安装中,我也得到相同的错误。



错误:

环境细节。



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



Eclipse:
版本:Juno Service Release 1
Build id:20121004-1855



插件:
m2e - Maven Integration for Eclipse 1.2.0.20120903-1050
m2e - slf4j超过对数记录(可选)1.2.0.20120903-1050



pom.xml

 < project xmlns =http:// mav zh-cn / 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>

<依赖关系>
<依赖关系>
< groupId> cc.mallet< / groupId>
< artifactId> mallet< / artifactId>
< version> 2.0.7-RC2< / version>
< / dependency>

<依赖关系>
< groupId> com.googlecode.efficient-java-matrix-library< / groupId>
< artifactId> ejml< / artifactId>
< version> 0.20< / version>
< / 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>
<执行>
< execution>
< id> shade< / id>
< goals>
< goal> shade< / goal>
< / goals>
< / execution>
< / executions>
< / plugin>
< / plugins>
< / build>

< / project>

有没有人有任何建议如何摆脱这个错误?

解决方案

您已在本地存储库中缓存文件。请参阅:
未能将commons-cli:commons-cli:jar:1.0从http://repo.maven.apache.org/maven2缓存到本地存储库



尝试删除 $ M2_HOME / repository code> $ M2_HOME / repository :




  • commons-cli / commons-cli *


I am working on a java maven project in eclipse using the m2e plugin. I updated my system and my jvm updated from icedtea-bin-6.1.11.4 to icedtea-bin-6.1.11.5. Eclipse now outputs the below error in my pom file and I can't run my project. I am new to maven and eclipse and, after a day of googling, I still haven't managed to find a solution for this.

I personally think that this is some sort of problem with eclipse (a misconfiguration?), because I am able to get a successful build on the command line with mvn clean install -U. Moreover, I get the same error even on a fresh eclipse install without the plugins installed.

Error:

Environment details.

Maven:Apache Maven 2.2.1 (r801777; 2009-08-06 20:16:01+0100)Java version: 1.6.0_24Java home: /opt/icedtea-bin-6.1.11.5/jre

Eclipse:Version: Juno Service Release 1Build id: 20121004-1855

Plugin:m2e - Maven Integration for Eclipse 1.2.0.20120903-1050m2e - slf4j over logback logging (Optional) 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>

Does anybody have any suggestions on how to get rid of this error?

解决方案

You have cached files in your local repository. See:
Failure to transfer commons-cli:commons-cli:jar:1.0 from http://repo.maven.apache.org/maven2 was cached in the local repository

Try to remove either $M2_HOME/repository or only mentioned files from your $M2_HOME/repository:

  • commons-cli/commons-cli*

这篇关于eclipse中的Maven项目依赖错误使用m2e插件(对于maven)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 06:56