1
votes

I'm using Eclipse Indigo + m2eclipse.

I have two projects in my workspace, projectA declaring a Maven dependency to projectB in its POM.xml.

I want to be able to make changes to projectB and, without having to run a "mvn install" on this projectB, being able to see the changes when I run projectA!

I have Properties/Maven/Resolve dependencies from Workspace projects checked on both projects. It doesn't work. I always have to do a "mvn install" on projectB (and potentially a "Maven/Updates Dependencies..." on projectA for the changes to be seen.

My dependency to projectB, in projectA's POM is :

    <dependency>
        <groupId>com.xxxx</groupId>
        <artifactId>projectB</artifactId>
        <version>0.7-SNAPSHOT</version>
    </dependency>

The groupId, artifactId and version match those found in projectB's POM.

I read everything I could found on the Internet to no success!

Any idea?

UPDATE : I don't know if this information may helps, but I also have a projectC in my workspace which also depends on projectB. And projectA depends on projectC :

projectA -> depends on -> projectB
projectC -> depends on -> projectB
projectA -> depends on -> projectC

The exact same version of the projectB artifact is used in both projectA and projectC. I tried excluding the transitive dependency to projectB in projectA's POM so only the direct dependency is used : it didn't change anything.

2
By the way, did you have a parent pom containing all three modules A, B and C in your project?Pablo Lascano
donsenior, no I have no parent pom. Is it required for the project dependencies to work using m2eclipse?electrotype
I'm not sure but I think it is required, so the plugin knows what the projects of your reactor are. You can try and let me know :) Is very simple to create a parent project. See herePablo Lascano

2 Answers

1
votes

You need to use a multimodule project where each of your current projects becomes a module. They will all have a common parent. Then you can invoke the build from the parent POM and the reactor will build the submodules in the order required. That way, your changes in ProjectB will be seen in ProjectA.

Here is an example
http://www.sonatype.com/books/mvnex-book/reference/multimodule.html

0
votes

Try using the "Update project configuration" feature. Also, you can run mvn eclipse:eclipse, by default the plugin will configure your project to use sub-project reference and not installed package references.