Maven SCM URL relative to parent

We have the following project structure in SVN with a parent (not an aggregator) project that defines the overall configuration. The parent is individually managed and freed.

trunk +parent pom.xml +project1 pom.xml +project1_1 pom.xml +project1_2 pom.xml +project2 pom.xml 

Thus, each real project (project1, project2) is used as an aggregator for its subprojects. General configuration parameters (Java Compiler version, other plugins) are stored in the parent object, which is used as the Maven parent in all projects (project1, project2).

One of the options that I would like to define in the parent is the SCM URL for Subversion, for example. http://svnhost/base/trunk/parent in parent pom.xml.

When I do this, individual projects inherit this option, but, of course, do not reflect the relative nature of the path. In project 1, this is allowed http://svnhost/base/trunk/parent/ - I checked this with mvn help:effective-pom .

Is there a way to specify an SCM connection so that it is resolved relative to the parent? Or do I need to provide an SCM URL in each individual project?

+6
source share
2 answers

It should be possible if you use properties like ${svn.host} and ${svn.path} to build scm.url. There was a bug in the release plugin in which the properties that were replaced during the release: http://jira.codehaus.org/browse/MRELEASE-128 , but since version 2.3, which seems to be fixed. So your kids only define properties, but no more than a scm url.

I do not know if this will help. You do not save many lines in pom.xml, and you present a danger that people do not change properties.

If you define the parent.scm.url property in the parent and then use this property in the child by adding the relative url ( <scm.url>${parent.scm.url}/../myproject</scm.url> ) If you relative path in scm.url based on this property, you still do not save most of the configuration?

I think that you really need you to want to write a plugin that reads the parent url, then reads the url from the current working copy (since maven does not know where else to find this project URL, since it is not configured), and then calculates the relative way from him. I think this is weird compared to just repeating the scm.url configuration in each pom.

+3
source

Inside a multi-module assembly, you only need to define a scm connection at the root level of your project. But your project layout is not like setting it right. Why don't you put your parent / pom.xml directly under the trunk folder? If you need to free the parent separately, this is an indication of making the parent a truly separate standalone maven project.

+2
source

All Articles