m2eclipse issues ArtifactTransferException - But pom.xml compiles / installs from the command line

自作多情 提交于 2020-04-07 14:22:11

问题


<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.cloudst</groupId>
     <artifactId>cloudst</artifactId>
     <version>0.1.2</version>
     <packaging>jar</packaging>

     <name>cloudst</name>
     <url>http://maven.apache.org</url>

     <repositories>
         <repository>
             <id>com.springsource.repository.bundles.release</id>
             <url>http://repository.springsource.com/maven/bundles/release/</url>
         </repository>
         <repository>
             <id>EclipseLink</id>
             <url>http://download.eclipse.org/rt/eclipselink/maven.repo</url>
         </repository>
         <repository>
            <id>java.net2</id>
            <name>Repository hosting the jee6 artifacts</name>
            <url>http://download.java.net/maven/2</url>
        </repository>
    </repositories>

    <dependencies>
         <dependency>
          <groupId>org.kitchen-eel</groupId>
      <artifactId>json-schema-validator</artifactId>
      <version>${kitchen-eel.version}</version>
    </dependency>

    <build>
        <finalName>cloudst</finalName>
        <plugins>
            <plugin>
               <artifactId>maven-compiler-plugin</artifactId>
               <version>2.5.1</version>
               <configuration>
                   <source>1.6</source>
                   <target>1.6</target>
               </configuration>
           </plugin>
    </build>
</project>

Am able to successfully clean, compile, and install this project from the command line using the standard mvn commands...

However, in Eclipse Juno's Problems pane, I have the following 2 errors:

  1. Missing artifact org.kitchen-eel:json-schema-validator:jar:1.2.1 pom.xml /com.cloudst line 45 Maven Dependency Problem

  2. ArtifactTransferException: Failure to transfer org.kitchen-eel:json-schema-validator:jar:1.2.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.kitchen-eel:json-schema-validator:jar:1.2.1 from/to central (http://repo.maven.apache.org/maven2):

Failed to transfer http://repo.maven.apache.org/maven2/org/kitchen-eel/json-schema-validator/1.2.1/json-schema-validator-1.2.1.jar.

Why does it work in the command line but m2eclipse is posting problems?

Thanks for taking the time to read this...


回答1:


This is very short tip to resolve the error “ArtifactTransferException: Could not transfer artifact” that may occur in Maven project in Eclipse.

Steps to resolve:

 1. Open folder by running this text (without Quotes) in Search Explorer of Window “%USERPROFILE%\.m2″.
 2. After running above command, “m2″ folder of maven will open. Now search for file (without Quotes) “*.lastUpdated”.
 3. In this step, delete all the files found by running Step 2.
 4. Now go to Eclipse project and select “Maven | Update Dependency” or “Maven | Update Project”.

Happy Coding.




回答2:


If you get such a connection error for all new artifacts: m2eclipse uses an embedded Maven instance by default, not your external Maven installation. The internal Maven instance might not use the same Maven settings like your external one (e.g. %USERPROFILE%/.m2/settings.xml), which then might lead to the internal Maven instance not being able to connect through your proxy.

You can use the Eclipse preferences to add your external Maven installation and to have it be used for running Maven commands from inside Eclipse.




回答3:


This is my solution.

find jar libraries that error occurred and delete from .m2 repo. Then update project using m2eclipse. It works for me.



来源:https://stackoverflow.com/questions/13425941/m2eclipse-issues-artifacttransferexception-but-pom-xml-compiles-installs-fro

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!