You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Ernst de Haan <er...@ernstdehaan.com> on 2010/05/24 19:18:30 UTC
Sharing a version among different modules
How do I share one version number across multiple module (subprojects)?
I have one parent pom.xml referencing 3 modules and -believe it or not- I've got the version number in 10 different locations:
- in the parent pom.xml, to denote the project version
- in each module, to denote the module version
- in each module's reference to the parent
- in each module's reference to a sibling
Any suggestions for reducing the number of locations (preferably to 1) ?
PS. To see the project and the POMs, see http://github.com/znerd/logdoc
Cheers,
Ernst
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Sharing a version among different modules
Posted by Ernst de Haan <er...@ernstdehaan.com>.
>> - in the parent pom.xml, to denote the project version
> you need this
>
>> - in each module, to denote the module version
> just leave out the version and it will inherit it from the parent pom
>
>> - in each module's reference to the parent
> you need this
>
>> - in each module's reference to a sibling
> <dependency>
> <groupId>${project.parent.groupId}</groupId>
> <artifactId>sibling-one</artifactId>
> <version>${project.parent.version}</version>
> </dependency>
Thanks a lot Kristian, this indeed improves the situation a *lot*. Instead of 10 references for 3 modules, I am now able to reduce it to:
1 + (1 per module)
However, I'll continue my quest to further reduction of replication, as my ultimate goal is still to have the version number in one place. Perhaps XInclude or so will do the trick.
Thanks heaps!
Ernst
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Sharing a version among different modules
Posted by Ernst de Haan <er...@ernstdehaan.com>.
Nicola and Todd,
This is *exactly* what I was looking for! The article Todd mentioned
explains it very well, both the challenges and the solutions.
Cheers!
Ernst de Haan
Op 25 mei 2010 om 15:03 heeft "Thiessen, Todd (Todd)" <tthiessen@avaya.com
> het volgende geschreven:\
> I use this method described by Nicole as well. Its described in
> great detail in the definitive guide.
>
> http://www.sonatype.com/books/mvnex-book/reference/optimizing-sect-dependencies.html
>
>> -----Original Message-----
>> From: Ernst de Haan [mailto:ernst@ernstdehaan.com]
>> Sent: Tuesday, May 25, 2010 8:58 AM
>> To: Maven Users List
>> Cc: Maven Users List
>> Subject: Re: Sharing a version among different modules
>>
>> Thanks, Nicola. Interesting alternative!
>>
>> So if I understand you correctly, you have version numbers on
>> the aggregator and on modules below that, but you just keep
>> those to a fixed vale (say "0") and use the root parent
>> version to the outside world?
>>
>> Cheers,
>>
>>
>> Ernst de Haan
>>
>> Op 25 mei 2010 om 14:28 heeft Nicola Musatti
>> <Nicola.Musatti@ObjectWay.it > het volgende geschreven:\
>>
>>> I keep all version numbers in the dependencyManagement
>> section of my
>>> parent POM, which is different from my aggregator POM and
>> is parent to
>>> the aggregator and all its modules. In this way I specify
>> each version
>>> exactly once. Something like:
>>>
>>> <dependencyManagement>
>>> <dependencies>
>>> <dependency>
>>> <groupId>bouncycastle</groupId>
>>> <artifactId>bcprov-jdk13</artifactId>
>>> <version>140</version>
>>> </dependency>
>>> </dependencyManagement>
>>>
>>> dependencyManagement is a direct child of the project element.
>>>
>>> Cheers,
>>> Nicola Musatti
>>>
>>> Ernst de Haan wrote:
>>>>>> - in the parent pom.xml, to denote the project version
>>>>>>
>>>>> you need this
>>>>>
>>>>>
>>>>>> - in each module, to denote the module version
>>>>>>
>>>>> just leave out the version and it will inherit it from the parent
>>>>> pom
>>>>>
>>>>>
>>>>>> - in each module's reference to the parent
>>>>>>
>>>>> you need this
>>>>>
>>>>>
>>>>>> - in each module's reference to a sibling
>>>>>>
>>>>> <dependency>
>>>>> <groupId>${project.parent.groupId}</groupId>
>>>>> <artifactId>sibling-one</artifactId>
>>>>> <version>${project.parent.version}</version>
>>>>> </dependency>
>>>>>
>>>> Thanks a lot Kristian, this indeed improves the situation
>> a *lot*.
>>>> Instead of 10 references for 3 modules, I am now able to reduce it
>>>> to:
>>>>
>>>> 1 + (1 per module)
>>>>
>>>> However, I'll continue my quest to further reduction of
>> replication,
>>>> as my ultimate goal is still to have the version number in
>> one place.
>>>> Perhaps XInclude or so will do the trick.
>>>>
>>>> Thanks heaps!
>>>>
>>>>
>>>> Ernst
>>>>
>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>> For additional commands, e-mail: users-help@maven.apache.org
>>>>
>>>>
>>>>
>>>
>>>
>>>
>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE: Sharing a version among different modules
Posted by "Thiessen, Todd (Todd)" <tt...@avaya.com>.
I use this method described by Nicole as well. Its described in great detail in the definitive guide.
http://www.sonatype.com/books/mvnex-book/reference/optimizing-sect-dependencies.html
> -----Original Message-----
> From: Ernst de Haan [mailto:ernst@ernstdehaan.com]
> Sent: Tuesday, May 25, 2010 8:58 AM
> To: Maven Users List
> Cc: Maven Users List
> Subject: Re: Sharing a version among different modules
>
> Thanks, Nicola. Interesting alternative!
>
> So if I understand you correctly, you have version numbers on
> the aggregator and on modules below that, but you just keep
> those to a fixed vale (say "0") and use the root parent
> version to the outside world?
>
> Cheers,
>
>
> Ernst de Haan
>
> Op 25 mei 2010 om 14:28 heeft Nicola Musatti
> <Nicola.Musatti@ObjectWay.it > het volgende geschreven:\
>
> > I keep all version numbers in the dependencyManagement
> section of my
> > parent POM, which is different from my aggregator POM and
> is parent to
> > the aggregator and all its modules. In this way I specify
> each version
> > exactly once. Something like:
> >
> > <dependencyManagement>
> > <dependencies>
> > <dependency>
> > <groupId>bouncycastle</groupId>
> > <artifactId>bcprov-jdk13</artifactId>
> > <version>140</version>
> > </dependency>
> > </dependencyManagement>
> >
> > dependencyManagement is a direct child of the project element.
> >
> > Cheers,
> > Nicola Musatti
> >
> > Ernst de Haan wrote:
> >>>> - in the parent pom.xml, to denote the project version
> >>>>
> >>> you need this
> >>>
> >>>
> >>>> - in each module, to denote the module version
> >>>>
> >>> just leave out the version and it will inherit it from the parent
> >>> pom
> >>>
> >>>
> >>>> - in each module's reference to the parent
> >>>>
> >>> you need this
> >>>
> >>>
> >>>> - in each module's reference to a sibling
> >>>>
> >>> <dependency>
> >>> <groupId>${project.parent.groupId}</groupId>
> >>> <artifactId>sibling-one</artifactId>
> >>> <version>${project.parent.version}</version>
> >>> </dependency>
> >>>
> >> Thanks a lot Kristian, this indeed improves the situation
> a *lot*.
> >> Instead of 10 references for 3 modules, I am now able to reduce it
> >> to:
> >>
> >> 1 + (1 per module)
> >>
> >> However, I'll continue my quest to further reduction of
> replication,
> >> as my ultimate goal is still to have the version number in
> one place.
> >> Perhaps XInclude or so will do the trick.
> >>
> >> Thanks heaps!
> >>
> >>
> >> Ernst
> >>
> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >> For additional commands, e-mail: users-help@maven.apache.org
> >>
> >>
> >>
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Sharing a version among different modules
Posted by Ernst de Haan <er...@ernstdehaan.com>.
Thanks, Nicola. Interesting alternative!
So if I understand you correctly, you have version numbers on the
aggregator and on modules below that, but you just keep those to a
fixed vale (say "0") and use the root parent version to the outside
world?
Cheers,
Ernst de Haan
Op 25 mei 2010 om 14:28 heeft Nicola Musatti <Nicola.Musatti@ObjectWay.it
> het volgende geschreven:\
> I keep all version numbers in the dependencyManagement section of my
> parent POM, which is different from my aggregator POM and is parent
> to the aggregator and all its modules. In this way I specify each
> version exactly once. Something like:
>
> <dependencyManagement>
> <dependencies>
> <dependency>
> <groupId>bouncycastle</groupId>
> <artifactId>bcprov-jdk13</artifactId>
> <version>140</version>
> </dependency>
> </dependencyManagement>
>
> dependencyManagement is a direct child of the project element.
>
> Cheers,
> Nicola Musatti
>
> Ernst de Haan wrote:
>>>> - in the parent pom.xml, to denote the project version
>>>>
>>> you need this
>>>
>>>
>>>> - in each module, to denote the module version
>>>>
>>> just leave out the version and it will inherit it from the parent
>>> pom
>>>
>>>
>>>> - in each module's reference to the parent
>>>>
>>> you need this
>>>
>>>
>>>> - in each module's reference to a sibling
>>>>
>>> <dependency>
>>> <groupId>${project.parent.groupId}</groupId>
>>> <artifactId>sibling-one</artifactId>
>>> <version>${project.parent.version}</version>
>>> </dependency>
>>>
>> Thanks a lot Kristian, this indeed improves the situation a *lot*.
>> Instead of 10 references for 3 modules, I am now able to reduce it
>> to:
>>
>> 1 + (1 per module)
>>
>> However, I'll continue my quest to further reduction of
>> replication, as my ultimate goal is still to have the version
>> number in one place. Perhaps XInclude or so will do the trick.
>>
>> Thanks heaps!
>>
>>
>> Ernst
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Sharing a version among different modules
Posted by Nicola Musatti <Ni...@ObjectWay.it>.
Ernst de Haan wrote:
> Thanks, Nicola. Interesting alternative!
>
> So if I understand you correctly, you have version numbers on the
> aggregator and on modules below that, but you just keep those to a
> fixed vale (say "0") and use the root parent version to the outside
> world?
No, once version numbers are specified in your parent POM's
dependencyManagement element you don't need to specify them again. To
give an example in a module POM I would specify a dependency to
bcprov-jdk13 as
<dependencies>
<dependency>
<groupId>bouncycastle</groupId>
<artifactId>bcprov-jdk13</artifactId>
</dependency>
</dependencies>
Cheers,
Nicola
> Cheers,
>
>
> Ernst de Haan
>
> Op 25 mei 2010 om 14:28 heeft Nicola Musatti
> <Ni...@ObjectWay.it> het volgende geschreven:\
>
>> I keep all version numbers in the dependencyManagement section of my
>> parent POM, which is different from my aggregator POM and is parent
>> to the aggregator and all its modules. In this way I specify each
>> version exactly once. Something like:
>>
>> <dependencyManagement>
>> <dependencies>
>> <dependency>
>> <groupId>bouncycastle</groupId>
>> <artifactId>bcprov-jdk13</artifactId>
>> <version>140</version>
>> </dependency>
>> </dependencyManagement>
>>
>> dependencyManagement is a direct child of the project element.
>>
>> Cheers,
>> Nicola Musatti
>>
>> Ernst de Haan wrote:
>>>>> - in the parent pom.xml, to denote the project version
>>>>>
>>>> you need this
>>>>
>>>>
>>>>> - in each module, to denote the module version
>>>>>
>>>> just leave out the version and it will inherit it from the parent pom
>>>>
>>>>
>>>>> - in each module's reference to the parent
>>>>>
>>>> you need this
>>>>
>>>>
>>>>> - in each module's reference to a sibling
>>>>>
>>>> <dependency>
>>>> <groupId>${project.parent.groupId}</groupId>
>>>> <artifactId>sibling-one</artifactId>
>>>> <version>${project.parent.version}</version>
>>>> </dependency>
>>>>
>>> Thanks a lot Kristian, this indeed improves the situation a *lot*.
>>> Instead of 10 references for 3 modules, I am now able to reduce it to:
>>>
>>> 1 + (1 per module)
>>>
>>> However, I'll continue my quest to further reduction of replication,
>>> as my ultimate goal is still to have the version number in one
>>> place. Perhaps XInclude or so will do the trick.
>>>
>>> Thanks heaps!
>>>
>>>
>>> Ernst
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Sharing a version among different modules
Posted by Nicola Musatti <Ni...@ObjectWay.it>.
I keep all version numbers in the dependencyManagement section of my
parent POM, which is different from my aggregator POM and is parent to
the aggregator and all its modules. In this way I specify each version
exactly once. Something like:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>bouncycastle</groupId>
<artifactId>bcprov-jdk13</artifactId>
<version>140</version>
</dependency>
</dependencyManagement>
dependencyManagement is a direct child of the project element.
Cheers,
Nicola Musatti
Ernst de Haan wrote:
>>> - in the parent pom.xml, to denote the project version
>>>
>> you need this
>>
>>
>>> - in each module, to denote the module version
>>>
>> just leave out the version and it will inherit it from the parent pom
>>
>>
>>> - in each module's reference to the parent
>>>
>> you need this
>>
>>
>>> - in each module's reference to a sibling
>>>
>> <dependency>
>> <groupId>${project.parent.groupId}</groupId>
>> <artifactId>sibling-one</artifactId>
>> <version>${project.parent.version}</version>
>> </dependency>
>>
> Thanks a lot Kristian, this indeed improves the situation a *lot*. Instead of 10 references for 3 modules, I am now able to reduce it to:
>
> 1 + (1 per module)
>
> However, I'll continue my quest to further reduction of replication, as my ultimate goal is still to have the version number in one place. Perhaps XInclude or so will do the trick.
>
> Thanks heaps!
>
>
> Ernst
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Sharing a version among different modules
Posted by kristian <m....@web.de>.
that is how do it (http://github.com/mkristian/jruby-maven-plugins/)
On Mon, May 24, 2010 at 10:48 PM, Ernst de Haan <er...@ernstdehaan.com> wrote:
> How do I share one version number across multiple module (subprojects)?
>
> I have one parent pom.xml referencing 3 modules and -believe it or not- I've got the version number in 10 different locations:
> - in the parent pom.xml, to denote the project version
you need this
> - in each module, to denote the module version
just leave out the version and it will inherit it from the parent pom
> - in each module's reference to the parent
you need this
> - in each module's reference to a sibling
>
<dependency>
<groupId>${project.parent.groupId}</groupId>
<artifactId>sibling-one</artifactId>
<version>${project.parent.version}</version>
</dependency>
regards Kristian
> Any suggestions for reducing the number of locations (preferably to 1) ?
>
> PS. To see the project and the POMs, see http://github.com/znerd/logdoc
>
> Cheers,
>
>
> Ernst
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
--
Kristian Meier + Saumya Sharma + Sanuka Meier
Vadakkethu House,
Edayanmula West PO - 689532,
Pathanamthitta District, Kerala, INDIA
tel: +91 468 2319577
protect your privacy while searching the net: www.ixquick.com
_=_
q(-_-)p
'_) (_`
/__/ \
_(<_ / )_
(__\_\_|_/__)
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Sharing a version among different modules
Posted by Ernst de Haan <er...@ernstdehaan.com>.
>> How do I share one version number across multiple module (subprojects)?
>>
>> Any suggestions for reducing the number of locations (preferably to 1) ?
>
> There's also the versions-maven-plugin...
Cheers, Wayne, the more options the better. I'll look at that as well.
Regards,
Ernst
-- trying to look at it the positive side of having to wade through more documentation ;-)
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Sharing a version among different modules
Posted by Wayne Fay <wa...@gmail.com>.
> How do I share one version number across multiple module (subprojects)?
>
> Any suggestions for reducing the number of locations (preferably to 1) ?
There's also the versions-maven-plugin...
Wayne
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Sharing a version among different modules
Posted by Ernst de Haan <er...@ernstdehaan.com>.
> But if you are using release plugin http://maven.apache.org/plugins/maven-release-plugin/ for releasing versions, same version numbers in poms are updating automatically. There is no need to have only one.
>
> See http://maven.apache.org/plugins/maven-release-plugin/prepare-mojo.html#autoVersionSubmodules
Martin, thanks a lot! This looks very promising.
/me goes off to do some more investigation and try things out...
Cheers,
Ernst
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Sharing a version among different modules
Posted by Martin Schayna <ma...@abra.eu>.
You can use {$parent.version} variable in modules poms.
But if you are using release plugin
http://maven.apache.org/plugins/maven-release-plugin/ for releasing
versions, same version numbers in poms are updating automatically. There
is no need to have only one.
See
http://maven.apache.org/plugins/maven-release-plugin/prepare-mojo.html#autoVersionSubmodules
Martin
On 24.5.2010 19:18, Ernst de Haan wrote:
> How do I share one version number across multiple module (subprojects)?
>
> I have one parent pom.xml referencing 3 modules and -believe it or not- I've got the version number in 10 different locations:
> - in the parent pom.xml, to denote the project version
> - in each module, to denote the module version
> - in each module's reference to the parent
> - in each module's reference to a sibling
>
> Any suggestions for reducing the number of locations (preferably to 1) ?
>
>
>