Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Import new Maven module in Eclipse automatically

I have a multi-module Maven project in a Subversion repository with many developers working on it with Eclipse + M2Eclipse. Now if a developer adds a module, others need to do an SVN update from the command line (as Eclipse doesn't see the common root of the Maven project), and import the new module manually as an Eclipse project.

Is there a way to do this automatically?

My project structure looks like this:

Working Copy                  Eclipse Workspace

working copy root   -X->
 +- parent          --->      +- parent
 |   \- pom.xml               |   \- pom.xml
 +- child1          --->      +- child1
 |   \- pom.xml               |   \- pom.xml
 +- child2          --->      +- child2
     \- pom.xml                   \- pom.xml
like image 633
Lóránt Pintér Avatar asked Nov 14 '22 14:11

Lóránt Pintér


1 Answers

You can have a pom in the root, that will have parent, child1, child2, etc as modules. After SVN update if there a new module was added, you can run

mvn eclipse:clean eclipse:m2eclipse 

from the eclipse tools button (right of the debug and run buttons)

If you are using TortoiseSVN you can set a post-update client side hook, but each developer will have to set it independently.

like image 79
David Rabinowitz Avatar answered Feb 22 '23 19:02

David Rabinowitz