Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 651
PacificNW_Lover Avatar asked Nov 16 '12 23:11

PacificNW_Lover


People also ask

What is POM XML in Eclipse?

A Project Object Model or POM is the fundamental unit of work in Maven. It is an XML file that contains information about the project and configuration details used by Maven to build the project. It contains default values for most projects.

How do I fix POM XML error in eclipse?

Additionally,right click on the pom. xml file in the 'project explorer' > click on 'validate'. This should remove the red-error mark on file, if there are no problems in the XML configuration.

What is embedded Maven in eclipse?

An embedded version of the Maven known as the Maven Embedder is already specified. This is what is used to execute Maven inside of Eclipse. If you have another installation of Maven which you would like to use instead of the Maven Embedder, you can add another Maven runtime by clicking on the Add..


2 Answers

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.

like image 178
srikanth_yarram Avatar answered Oct 02 '22 08:10

srikanth_yarram


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.

like image 27
Bananeweizen Avatar answered Oct 02 '22 07:10

Bananeweizen