PacificNW_Lover
PacificNW_Lover

Reputation: 5374

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

<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...

Upvotes: 8

Views: 20343

Answers (4)

Akshay Ramteke
Akshay Ramteke

Reputation: 1

i was having same error. I had created springBoot maven project with spring mvc dependency but in pom.xml file i was having error like failed to transfer from central repository. To resolve This i just go to .m2 folder and search for folder with version and deleted all file and rerun maven project it downloaded all file again it work!!

Upvotes: 0

srikanth_yarram
srikanth_yarram

Reputation: 957

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.

Upvotes: 23

Damith Ganegoda
Damith Ganegoda

Reputation: 4328

This is my solution.

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

Upvotes: 1

Bananeweizen
Bananeweizen

Reputation: 22070

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.

Upvotes: 1

Related Questions