Search code examples
javaeclipsemavenm2e

Preventing m2e from un-exporting Maven dependencies on project update


I am looking at using Maven projects in Eclipse 4.2 to allow non-Maven Java projects in my workspace to use external libraries with less maintenance effort. To achieve this effect, I enable the Maven Dependencies check-box under the Java Build Path -> Order and Export tab.

I have noticed, however, that updating the Maven project changes that setting back. More specifically, in .classpath this:

<classpathentry exported="true" kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">

turns into this:

<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">

Is there a way to prevent this from happening? The whole point of having Maven projects in my case is that their dependencies would be exported.

Is there a better way to do this, except for converting all other projects to Maven?


Solution

  • Short answer is this is not supported by m2e plugin.

    Since you only exporting Maven dependencies, nothing really stopping you from adding those dependencies manually to your other projects as external jars from local maven repository.

    Though it still would be simpler to mavenize your projects.