Deepak Joy Cheenath
Deepak Joy Cheenath

Reputation: 6006

Maven error "Failure to transfer..."

I am trying to set up a project using Maven (m2eclipse), but I get this error in Eclipse:

Description Resource Path Location Type Could not calculate build plan: Failure to transfer org.apache.maven.plugins:maven-compiler-plugin:pom:2.0.2 from http://repo1.maven.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.apache.maven.plugins:maven-compiler-plugin:pom:2.0.2 from/to central (http://repo1.maven.org/maven2): No response received after 60000 ExampleProject Unknown Maven Problem

Any ideas? It would be helpful if you could show me how to check if everything is configured fine...

Upvotes: 340

Views: 633580

Answers (25)

Marco Frag Delle Monache
Marco Frag Delle Monache

Reputation: 1448

In my case, it was a wrong version of Java being used (7 instead of 8). Hope it can still help somebody!

To quickly change the java version, you can either specify (or change, if already present) the JAVA_HOME environment variable and add its bin/ to the PATH in Windows or use this command for Linux.

update-alternatives --config java

In-depth guide here.
Note that, for Windows, you have to restart your computer to apply the changes. If you are using an IDE, then probably it's using a different JDK than your system.

Upvotes: 0

Dhamith Kumara
Dhamith Kumara

Reputation: 864

In my case, I got this error message in spring tool 4

ArtifactTransferException: org.codehaus.plexus:plexus-interpolation:jar:1.26 failed to transfer from https://repo.maven.apache.org/maven2 during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.codehaus.plexus:plexus-interpolation:jar:1.26 from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org java.lang.reflect.InvocationTargetException

Here is the solution

step 01 - first close the spring tool Application

step 02 - go to path C:\Users\User and Delete .m2 folder

folder location

step 03 - Now go to package Explore and select your project

Package Explorer

step 04 - Now Right Click on your project and go to the Maven and click Update Project

Update Project

How to uninstall Spring Tool 4

step 01 - click on Help and Go to the About Spring Tool Suite 4

enter image description here

step 02 - Now click on Installation Details

Installation Details

step 03 - inside of that you can see the all Installed Software, simply press Ctrl + A to select all and click Uninstall

Uninstall

Upvotes: 0

Shadyar
Shadyar

Reputation: 825

I got this error for the plugin below:

<groupId>org.codehaus.mojo</groupId>  
<artifactId>jaxb2-maven-plugin</artifactId>  
<version>2.5</version>  

I modified tag version to:

<version>2.5.0</version>  

Then open Context menu on your project in eclipse and choose Maven > "Update Project ...", make sure "Update Dependencies" is checked in the dialog box and hit "OK" button.

Upvotes: 0

Vikas Gaurav
Vikas Gaurav

Reputation: 254

Remove all files inside repository.

Go to C:\Users\DELL.m2\repository, select all the files and delete it.

Then go to project, right click maven update project (Alt+F5). It will download all the dependent files inside repository.

Upvotes: -1

林万程
林万程

Reputation: 381

create a file delete_lastUpdated_and_remote.sh(use \n):

#!/bin/bash
find $(cd $(dirname $0); pwd) -name "*.lastUpdated" -type f -print -exec rm -rf {} \;
find $(cd $(dirname $0); pwd) -name "_remote.repositories" -type f -print -exec rm -rf {} \;

Put it in the local Maven repo, such as %userprofile%\.m2\repository or ~/.m2/repository, and run it.

In windows, you should install Git to run sh file also.

I also use it in jenkins job.

Upvotes: 0

VIKAS KESHARWANI
VIKAS KESHARWANI

Reputation: 41

for mac

I removed all the old failed downloads of maven there were several versions of maven also on my mac

find ~/.m2 -name "*.lastUpdated" -exec grep -q "Could not transfer" {} ; -print -exec rm {} ;

after that, I simply updated my eclipse by

help -> check for updates

and the problem resolved for me

the main reason for this problem is the failed old updates does not allow you to download archetype so if you try to build project in any archetype of maven it gets failed

Upvotes: 0

Avinash Pande
Avinash Pande

Reputation: 1538

  • Above Error occured due to removing of 'maven-compiler-plugin 2.0.2' from maven repository.
  • For me, Above error gets resolved when I downgrade 'maven-compiler-plugin' to version to either 2.0 or 2.0.1.

Upvotes: 0

Jorge Santos Neill
Jorge Santos Neill

Reputation: 1785

The solution that work for me is the following:

  1. Copy the dependency to pom.

    <dependency>
        <groupId>org.apache.maven</groupId>
        <artifactId>maven-archiver</artifactId>
        <version>2.5</version>
    </dependency>
    
  2. Click right on your project

  3. Select Maven
  4. Select Update project
  5. Select Force Update of Snapshots/Releases

Upvotes: -1

R Tiwari
R Tiwari

Reputation: 335

You could delete the .m2 folder itself and force MyEclipse to re-download all dependencies on startup. Go to Window > Preferences > MyEclipse > Maven4MyEclipse.

Upvotes: 0

huan le
huan le

Reputation: 263

In my case. The issues is same reason. I see the problem is on proxy and firewall.

Here my solution
Fisrt ways:
1. install Proxy for Maven and Eclipse
2. Go to Locate the {user}/.m2/repository and Remove all the *.lastupdated files
3. Go back into Eclipse, Right-click on the project and select Maven > Update Project. > Select "Force Update of Snapshots/Releases".

If the project is still exist error. example: here is my issues after all above step

Failure to transfer org.apache.maven:maven-archiver:pom:2.5 from https://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.apache.maven:maven-archiver:pom:2.5 from/to central (https://repo.maven.apache.org/maven2): Connect timed out

I use this solution useful for me:
1. Find repository in https://mvnrepository.com/
2. Copy dependency to my *.poml of project
example

<dependency>
    <groupId>org.apache.maven</groupId>
    <artifactId>maven-archiver</artifactId>
    <version>2.5</version>
</dependency>


3. Build project. the dependency missing will be downloaded to local repository.
4. Go back into Eclipse, Right-click on the project and select Maven > Update Project. > Select "Force Update of Snapshots/Releases".
=>> Error is resolved
5. I remove dependencies at step 2 after finished and resolved. Done

Upvotes: 13

Lamine BA
Lamine BA

Reputation: 129

For me I just added the bellow xml code in the POM.xml file. And after I dit **right click in the project -> Maven -> Update Project and I checked Force Update of Snapshots/Releases ** and every thing worked

    <dependencies>
        <!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/javax.servlet.jsp/jsp-api -->
        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.1</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/jstl/jstl -->
        <dependency>
            <groupId>jstl</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>
    </dependencies>

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

Upvotes: 1

sumeet kumar
sumeet kumar

Reputation: 351

This worked for me in Windows:

  1. Locate the {user}/.m2/repository
  2. In the Search field in upper right of window, type ".lastupdated". Windows will look through all subfolders for these files in the directory.
  3. Remove all the .lastupdated files.
  4. Go back into Eclipse, Right-click on the project and select Maven > Update Project.
  5. Select "Force Update of Snapshots/Releases".
  6. Click Ok and the dependencies will finally resolve correctly.

Upvotes: 12

Jonas Andersson
Jonas Andersson

Reputation: 8728

Remove all your failed downloads:

find ~/.m2  -name "*.lastUpdated" -exec grep -q "Could not transfer" {} \; -print -exec rm {} \;

For windows:

cd %userprofile%\.m2\repository
for /r %i in (*.lastUpdated) do del %i

Then rightclick on your project in eclipse and choose Maven->"Update Project ...", make sure "Update Dependencies" is checked in the resulting dialog and click OK.

Upvotes: 820

iowatiger08
iowatiger08

Reputation: 1962

This worked for me in Windows as well.

  1. Locate the {user}/.m2/repository (Using Juno /Win7 here)
  2. In the Search field in upper right of window, type ".lastupdated". Windows will look through all subfolders for these files in the directory. (I did not look through cache.)
  3. Remove them by Right-click > Delete (I kept all of the lastupdated.properties).
  4. Then go back into Eclipse, Right-click on the project and select Maven > Update Project. I selected to "Force Update of Snapshots/Releases". Click Ok and the dependencies finally resolved correctly.

Upvotes: 76

HansiRadhakrishnan
HansiRadhakrishnan

Reputation: 21

Give correct maven setting.xml path in eclipse.

  • Windows --> Preference --> Maven --> User Settings

Enter correct setting.xml path in user settings text box

Upvotes: 2

Mohit Singh
Mohit Singh

Reputation: 6167

It Happened to me also you may have two solue=tion for this

  1. If your project consist of some external or project specificdependency in it then you have to manually add it to your M2 repo folder which is located at C:\Users\Mohit.Singh.m2\repository folder and then you have to run mvn eclipse:eclipse and then mvn clean install from the project folder

  2. if you do not have any wxternal or project sppecific dependency then you may import the project into eclipse as Existing maven project then right click on project --> GO to maven --> Click on update project a window will appear check the force snapshot download option and hit on OK

Upvotes: 2

Pravat Panda
Pravat Panda

Reputation: 1090

just delete the archetype in maven local repository. As said above, it happens in case of failed archetype downloads.

Upvotes: 1

Zhenya
Zhenya

Reputation: 6198

In Eclipse: Right click the project->Maven->Update Project->Check checkbox "Force Update of Snapshots/Releases". Click OK.

Upvotes: 45

Deepak Joy Cheenath
Deepak Joy Cheenath

Reputation: 6006

Thanks for the replies, but after some more searching I was able to fix the problem. It turned out that I had to remove one of the "*.lastUpdated" which was preventing one of my plugins (Maven Surefire Plugin) from updating. I did this manually, because a maven clean wasn't doing it apparently.

The problem was that the "*.lastUpdated" file for a plugin was blocking the maven check for updates and not allowing a necessary jar to get downloaded.

Upvotes: 20

Knp
Knp

Reputation: 79

It happened to me as Iam behind a firewall. The dependencies doesn't get downloaded sometimes when you are running in Eclipse IDE. Make sure you use mvn clean install -U to resolve the problem. You would see the dependencies download after this.

Upvotes: 8

smith.gt
smith.gt

Reputation: 109

I had a similar issue with only a few projects in my workspace. Other projects with nearly identical POMs didn't have an error at all. None of the other answers listed fixed my problem. I finally stumbled upon removing/re-applying the Maven nature for each project and the errors disappeared:

For each project that has a pom with the "resolution will not be reattempted..." error:

  1. Right-click on the project in Eclipse and select Maven->Disable Maven Nature
  2. Right-click on the project in Eclipse and select Configure->Convert to Maven Project

Upvotes: 2

roi
roi

Reputation: 21

settings.xml for proxy? and in eclipse there are maven global\local profile, add the settings.xml

Upvotes: 0

Luki
Luki

Reputation: 41

I had similar issue in Eclipse 3.6 with m2eclipse.

Could not calculate build plan: Failure to transfer org.apache.maven.plugins:maven-resources-plugin:jar:2.4.3 from http://repo1.maven.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.apache.maven.plugins:maven-resources-plugin:jar:2.4.3 from central (http://repo1.maven.org/maven2): ConnectException project1 Unknown Maven Problem

Deleting all maven*.lastUpdated files from my local reository (as Deepak Joy suggested) solved that problem.

Upvotes: 4

Abel Morelos
Abel Morelos

Reputation: 1248

If you are behind a proxy, you have to update the settings.xml file (under the conf folder of your MAVEN_HOME, the file itself contains information about the proxy settings) and additionally you may need to update your Eclipse Network Settings (Window->Preferences...-> type Network Connections).

Try using -X or --debug in order to get the debug output, this could provide additional information about the problem.

Upvotes: 5

Lev Khomich
Lev Khomich

Reputation: 2247

Try to execute

mvn -U clean

or Run > Maven Clean and Maven > Update snapshots from project context menu in eclipse

Upvotes: 18

Related Questions