Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-users] M2E Update Project issue

Running maven-dependency-plugin inside workspace is not supported. From m2e wiki [1]

Beware that m2e does not provide any safeguards against rogue maven
plugins that leak classloaders, modify random files inside workspace or
throw nasty exceptions to fail the build. Use this as the last resort
and make sure you know what you are doing.

Can you reproduce the problem without this?



On 12-06-22 9:23 AM, Dave Hartnoll wrote:
I am putting together a large Eclipse RCP project using Eclipse 3.7.2, Tycho 0.15.0 and m2e 1.1 latest. On several occasions, I have seen errors along the lines of "The project is not up to date with the pom. Run Update Project" (paraphrasing from memory). This happens more often when updating a project from source control such as when committing changes from one PC and updating on another. The problem is that running Maven->Update Project... does not always resolve the problem immediately - it sometimes has to be run twice - with no net change in any of the project data.

I've managed to extract and simplify a single small project that can be used to repeat some of the anomalies I am seeing. This project simply repackages a standard jar library (Log4j) as an OSGi plug-in. There may be better ways to do this, and as an aside I'd be interested to hear them, but this is really irrelevant for now as I get similar issues with a larger multi-package maven-structured Java project too.

The attached .zip contains the necessary Eclipse project files.
   1. Create a new general project (File->New->Project... then General->Project)
   2. Copy the contents of the .zip to the project (overwriting the existing .project file).
   3. Right-click project, choose Run As->Maven build
   4. In the 'Edit Configuration' dialogue, type 'package' into the Goals field
   5. Click 'Refresh' tab; click 'Refresh resources upon completion'
   6. Click 'Run'

Maven should now download some artifacts and build the OSGi version of the Log4j library.

Next, open the .classpath from the project so you can see what happens during the next steps. (If you can't see .classpath, open the Package Explorer menu - the down-pointing white triangle - and select 'Filters...'. In the next dialogue, uncheck '.* resources' and click OK.)

Now here is the weird behaviour...
    a. Right-click the project and select 'Maven->Update Project...'. Click OK in the next dialogue.
    b. Notice what happens to the contents of .classpath

Repeat steps a and b a few more times and notice how eventually the project toggles between two states, one of which is OK (but contains more than necessary) and the other which has errors - the .classpath only references a 'classes' folder (that is also not necessary), but loses the reference to the needed library.

I'm not sure if this is purely an m2e bug or an understanding/configuration issue that has caused m2e to behave strangely. Any help gratefully received. (NB: although I'm using m2e 1.1 latest from sonatype's repo, I'm seeing similar issues with m2e 1.0 from


P.S. In case anyone can't access the .zip file, I've listed the 5 files that seed the Eclipse project below

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Log4j as OSGI plugin
Bundle-SymbolicName: jar2plugin.log4j
Bundle-Version: 1.2.16
Bundle-ClassPath: target/libs/log4j-1.2.16.jar
Export-Package: org.apache.log4j,
Bundle-RequiredExecutionEnvironment: JavaSE-1.6

<?xml version="1.0" encoding="UTF-8"?>
	<classpathentry kind="lib" path="target/libs/log4j-1.2.16.jar"/>

<?xml version="1.0" encoding="UTF-8"?>

bin.includes = META-INF/,\

<project xmlns=""; xmlns:xsi=""; xsi:schemaLocation="";>









m2e-users mailing list

Back to the top