m2eclipse says "Missing artifact" but I can build from cmdline!

Pino picture Pino · Mar 31, 2011 · Viewed 47.2k times · Source

I'm trying to use this Sonatype Eclipse plugin for the first time to handle an existing (huge) software that I can build with maven form the command line.

I have configured the plugin to use my maven 2.2.1 installation instead of the built-in Maven 3.

In Eclipse I have 25 projects (loaded through the root pom.xml) and 4 of them have compilation errors; the maven console contains a lot of lines like this one:

Missing artifact commons-logging:commons-logging:jar:1.0.4:compile

I have all the jars in my repository and the M2_REPO classpath variable correctly defined. Why the plugin doesn't see all the jars?

The .classpath file of those projects simply references "MAVEN2_CLASSPATH_CONTAINER", there isn't a list of the jars. The pom.xml in Eclipse shows an error on the first line for the missing jars but I can build from the command line!

Any idea? I need help! I will try to move to NetBeans if I don't solve this problem.

Thank you.

Answer

Damian picture Damian · Dec 3, 2014

You may need to to tell Eclipse to force update:

Project -> Maven -> Update Maven Project

and then make sure you have selected:

Force Updates of Snapshots/Releases

this happens when mvn install copies some jar files into Maven repository and Eclipse had checked this repo BEFORE this jar has been copied there.