I am using Eclipse Luna and I have two Maven Java projects A and B where A depends on B. I want to edit them concurrently (and benefit from Eclipse's refactorization features etc). What is the best setup for this?
I am currently using the following setup that has some shortcomings, as described below.
I first build project B and install it, and generate an Eclipse project
# cd B
B # mvn package install
B # mvn eclipse:eclipse
I then build A and generate an Eclipse project:
# cd ../A
A # mvn package
A # mvn eclipse:eclipse
I can now import both projects into Eclipse.
My problem is that A now uses the installed B version and not the version that is currently open in Eclipse.
That is, after each update to B, I have to do mvn install
for B and (apparently) mvn eclipse:eclipse
for A to see my changes to B reflected in Eclipse.
Is there any better way?
I think your problem is, that eclipse:eclipse generate a classpath entry for each dependency like
<classpathentry kind="var" path="M2_REPO/com/google/guava/guava/18.0/guava-18.0.jar"/>
in the file .classpath instead of
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/>
I don't know which goal do it better, but when you import your maven projects with the import wizard of eclipse, then the .classpath file will be configured with the MAVEN2_CLASSPATH_CONTAINER.
You need the plugin http://eclipse.org/m2e/ to use the dynamic dependency management.