Maven – m2e: convert project to maven project

m2em2eclipsemaven

I'm trying to start with maven using m2e plugin for eclipse. But if I try to change existing project to Maven project (Configure/Convert to Maven Project), result is:

Multiple annotations found at this line:

  • Failure to transfer org.apache.maven.plugins:maven-resources-plugin:pom: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:pom:2.4.3 from/to central (http://repo1.maven.org/maven2): Connect times out
  • Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (execution: default-compile, phase: compile)
  • CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:2.3.2 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:2.3.2: ArtifactResolutionException: Failure to transfer org.apache.maven.plugins:maven-compiler-plugin:pom:2.3.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.3.2 from/to central (http://repo1.maven.org/maven2): Connect times out
  • Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:2.3.2:testCompile (execution: default-testCompile, phase: test-compile)

I'm not behind the firewall (I was able to download and install m2e using eclipse installation interface).

Where could be the problem?

UPDATE (generated 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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>PRJ</groupId>
  <artifactId>PRJ</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>
</project>

Best Answer

You should actually remove all libs you have in WEB-INF/lib directory and add adequate dependency declarations in the POM. WEB-INF directory itself (and other web resources) should stay in src/main/webapp. If you have some non-Java files in WEB-INF/classes, move them into src/main/resources. After all, do Maven build on console by mvn clean package and tell if it works. It should. Then regenerate Eclipse project files by Maven -> Update Project Configuration....

I don't believe in such tools for automagic migration of freestyle (mostly Ant) projects into Maven. As I see, it does nothing more that generate almost plain POM.