30

I wanna make web project using the Maven to import automatically all libraries that I need, so I chose "maven-archetype-webpp"

after that I got this error on pom.xml file :

Description Resource Path Location Type Failure to transfer org.apache.maven.plugins:maven-surefire-plugin:pom:2.12.4 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.apache.maven.plugins:maven-surefire-plugin:pom:2.12.4 from/to central (http://repo.maven.apache.org/maven2): The operation was cancelled. pom.xml /SpringTuto line 1 Maven Configuration Problem

I've updated my Maven project but with no results !!

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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.pre.example</groupId>
  <artifactId>SpringTuto</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>SpringTuto Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <finalName>SpringTuto</finalName>
  </build>
</project>
Dharman
  • 30,962
  • 25
  • 85
  • 135
AHmedRef
  • 2,555
  • 12
  • 43
  • 75

9 Answers9

84

You need just to follow those steps:

  1. Right Click on your project: Run (As) -> Maven clean
  2. Right Click on your project: Run (As) -> Maven install

After which, if the build fails when you do Maven Install, it means there is no web.xml file under WEB-INF or some problem associated with it. it really works

Community
  • 1
  • 1
Mohamed NAOUALI
  • 2,092
  • 1
  • 23
  • 29
12

Right click on project-> Maven->Click checked box 'Force Update'->Update

Jamal
  • 763
  • 7
  • 22
  • 32
rahulnikhare
  • 1,362
  • 1
  • 18
  • 25
4

In my case it was a failed import to eclipse. I had to delete the project from eclipse (without deleting form the filesystem of course) and reimport it. After that the error was gone immediately.

lilalinux
  • 2,903
  • 3
  • 43
  • 53
  • Saved my day, thanks for the tip. In my case I transfer the project to a new PC and hell broke loose... – Yee Mar 30 '22 at 13:36
2

just right click on your project, hover maven then click update project.. done!!

  • 3
    OP states "im updated my Maven project but with no results ". You say simply updating the project is the solution. Really? – Bö macht Blau Oct 06 '17 at 16:38
1

If you are using Eclipse Neon, try this:

1) Add the maven plugin in the properties section of the POM:

<properties>
    <java.version>1.8</java.version>
    <maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
</properties>

2) Force update of project snapshot by right clicking on Project

Maven -> Update Project -> Select your Project -> Tick on the 'Force Update of Snapshots/Releases' option -> OK

Ishank Gulati
  • 633
  • 1
  • 8
  • 22
0

Right Click on your project: Run (As) -> Maven clean Right Click on your project: Run (As) -> Maven install

harun ugur
  • 1,718
  • 18
  • 18
0

For Unix Users

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

Right-click your project and choose Update Dependencies

For Windows

  • CD (change directory) to .m2\repository
  • execute the command for /r %i in (*.lastUpdated) do del %i
  • Then right-click your project and choose Update Dependencies
Ganesa Vijayakumar
  • 2,422
  • 5
  • 28
  • 41
0

In my case eclipse was using an old settings.xml file.

amanzoor
  • 389
  • 4
  • 6
0

I have an easier solution for this issue which worked for me like a charm.

Just select Your project.

Right click and select Properties.

In Left sidebar list select Java Build Path.

in the Order and Export tab check (1) JRE System Library[your java Version] and (2) Maven Dependencies ( which is initially unchecked ).

Then click apply and close Button.

just update your project ( automatically updates when hit apply and close ) and the Error is gone.