some personal, more technical – by Thomas Einwaller
Some of you may not know this, but the m2eclipse plugin supports multimodule maven projects perfectly. I switched my project layout two months ago and I am very happy with the results. I am now able to create new release of my product containing all of its components with one single command.
Before I changed to maven modules I had the following layout:
timrbase
timrweb
timrws
Each one was a separate Eclipse project. I had to call mvn release:perform for each project and the version numbers and dependencies had to be maintained separately. The folder structure for a maven project with multiple modules looks like that:
timr
- timrbase
- timrweb
- timrws
The modules are directories INSIDE the parent project. The parent project uses pom as packaging mode. This layout does not work well with the Eclipse workspace layout were project have a flat structure and each project has to reside in its own directory.
If you create this folder structure using the m2eclipse plugin wizards the plugin creates the directories as shown above in the file system but “simulates” Eclipse that there are additional folders for each module. So you are able to use the mvn command line as with every normal maven project and Eclipse is able to compile the “simulated” projects.
It is important to treat all multimodule projects in Eclipse from the beginning with the m2eclipse plugin. This means if you want to check out an exiting multimodule project from the source code repository you have to do it by using the menu action “Check out as maven project”. Otherwise the plugin does not create the “simulated” projects for Eclipse. There are m2eclipse integrations for CVS, Subclipse and Subversive. If you are importing existing projects from the file system there is also an import command “Import existing maven project”.