Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven: SCM and multimodules projects

I have a big multimodules project and I want to specify SCM infos to Maven. But, each one of the modules and the parent project have a dedicated folder on SVN, so it seems that SCM infos are specific to each module.

Which value I need to use for the connection and developerConnection elements? Do I need to configure SCM per module or it can be configured once in the parent project?

Thanks

like image 297
manash Avatar asked Dec 07 '11 15:12

manash


People also ask

What is SCM Maven?

Maven SCM supports Maven plugins (for example maven-release-plugin) and other tools by providing them with a common API for source code management operations. You can look at the list of SCMs for more information on using Maven SCM with your favorite SCM tool.

What is the difference between Maven module and Maven project?

a maven module is like a maven "sub-project". a maven project includes 1 or more modules. more info here. Typically, a module generates a single artifact (jar, war, zip, etc), although this is not always true.

What is a multi-module Maven project?

A multi-module project is built from an aggregator POM that manages a group of submodules. In most cases, the aggregator is located in the project's root directory and must have packaging of type pom. The submodules are regular Maven projects, and they can be built separately or through the aggregator POM.

Can a Maven project have multiple pom files?

Yes you can use Maven Profiles to manage this. Obviously you can tweak this approach to suit your needs however works best.


1 Answers

I tested two scenarios:

  • Defining the configuration only at the parent-pom level;

  • Defining the configuration at both the parent-pom and submodule level.

If you try mvn -DdryRun=true release:prepare on your parent pom project, you will get a release.properties file that shows you the release configuration maven would have used if it had actually performed the prepare goal.

From there, you can see, when testing the first scenario that maven will not tag the child modules. You will only see one project.scm.[groupId]\:[artifactId].url property. Testing the second scenario, with scm configuration done also at the submodule level, you will get one property for each submodule.

My conclusion is that for flat multi-module project structure, you should define scm at both the parent-pom and module level, each one pointing to the scm directory where this pom is located.

like image 96
johnmartel Avatar answered Sep 28 '22 12:09

johnmartel