You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "C. Benson Manica" <cb...@gmail.com> on 2010/08/11 18:18:51 UTC

Parent and child projects share same version

I have a parent project and two child projects - the directory structure is

pom.xml
--child1/pom.xml
--child2/pom.xml

The top-level pom defines all the dependencies for the children - child1
contains the actual sources and child2 is merely a placeholder for
aggregating the transitive dependencies into a separate artifact.  Obviously
the top level pom and child1's pom need to be synchronized version-wise so
that child1 is built against the right dependencies, but there appears to be
no way to avoid having to manually bump child1's <parent> element so that it
inherits from the right version of the top-level pom.  Even a reasonable
hack in child1's pom,

<version>1.3-SNAPSHOT</version>
<parent>
  <groupId>xx</groupId>
  <artifactId>yy</artifactId>
  <version>${project.version}</version>
</parent>

doesn't work - ${project.version} doesn't seem to be substituted with
1.3-SNAPSHOT in time for the dependency to resolve correctly.  Am I stuck
with manually editing the <version> tag every time I release the top-level
pom or am I missing something?

-- 
C. Benson Manica
cbmanica@gmail.com

RE: Parent and child projects share same version

Posted by "Yanko, Curtis" <cu...@uhc.com>.
Looks backwards to me. I put a version in the Parent and then don't list
on in the children at all, it get's inherited. 


________________________________

Curt Yanko | Continuous Integration Services | UnitedHealth Group IT 
Making IT Happen, one build at a time

-----Original Message-----
From: C. Benson Manica [mailto:cbmanica@gmail.com] 
Sent: Wednesday, August 11, 2010 12:19 PM
To: Maven Users List
Subject: Parent and child projects share same version

I have a parent project and two child projects - the directory structure
is

pom.xml
--child1/pom.xml
--child2/pom.xml

The top-level pom defines all the dependencies for the children - child1
contains the actual sources and child2 is merely a placeholder for
aggregating the transitive dependencies into a separate artifact.
Obviously the top level pom and child1's pom need to be synchronized
version-wise so that child1 is built against the right dependencies, but
there appears to be no way to avoid having to manually bump child1's
<parent> element so that it inherits from the right version of the
top-level pom.  Even a reasonable hack in child1's pom,

<version>1.3-SNAPSHOT</version>
<parent>
  <groupId>xx</groupId>
  <artifactId>yy</artifactId>
  <version>${project.version}</version>
</parent>

doesn't work - ${project.version} doesn't seem to be substituted with
1.3-SNAPSHOT in time for the dependency to resolve correctly.  Am I
stuck with manually editing the <version> tag every time I release the
top-level pom or am I missing something?

--
C. Benson Manica
cbmanica@gmail.com

This e-mail, including attachments, may include confidential and/or
proprietary information, and may be used only by the person or entity
to which it is addressed. If the reader of this e-mail is not the intended
recipient or his or her authorized agent, the reader is hereby notified
that any dissemination, distribution or copying of this e-mail is
prohibited. If you have received this e-mail in error, please notify the
sender by replying to this message and delete this e-mail immediately.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Parent and child projects share same version

Posted by "C. Benson Manica" <cb...@gmail.com>.
Ah, got it.  Thank you for your help!!

On Wed, Aug 11, 2010 at 1:36 PM, Wendy Smoak <ws...@gmail.com> wrote:

> On Wed, Aug 11, 2010 at 1:09 PM, C. Benson Manica <cb...@gmail.com>
> wrote:
> > Yes, the parent pom has the modules in it - so I see that yes, it does
> > actually do that for me, although it wasn't clear to me it was going to
> do
> > that from the documentation.  It does prompt me three times for the
> release
> > and new development versions - is there a way to get it to prompt me only
> > once for each?
>
> Yes, set autoVersionSubmodules to true.
>
>
> http://maven.apache.org/plugins/maven-release-plugin/prepare-mojo.html#autoVersionSubmodules
>
> It will look like the tagBase config shown on
> http://maven.apache.org/plugins/maven-release-plugin/usage.html .
>
> --
> Wendy
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
C. Benson Manica
cbmanica@gmail.com

Re: Parent and child projects share same version

Posted by Wendy Smoak <ws...@gmail.com>.
On Wed, Aug 11, 2010 at 1:09 PM, C. Benson Manica <cb...@gmail.com> wrote:
> Yes, the parent pom has the modules in it - so I see that yes, it does
> actually do that for me, although it wasn't clear to me it was going to do
> that from the documentation.  It does prompt me three times for the release
> and new development versions - is there a way to get it to prompt me only
> once for each?

Yes, set autoVersionSubmodules to true.

http://maven.apache.org/plugins/maven-release-plugin/prepare-mojo.html#autoVersionSubmodules

It will look like the tagBase config shown on
http://maven.apache.org/plugins/maven-release-plugin/usage.html .

-- 
Wendy

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Parent and child projects share same version

Posted by "C. Benson Manica" <cb...@gmail.com>.
Yes, the parent pom has the modules in it - so I see that yes, it does
actually do that for me, although it wasn't clear to me it was going to do
that from the documentation.  It does prompt me three times for the release
and new development versions - is there a way to get it to prompt me only
once for each?

On Wed, Aug 11, 2010 at 12:58 PM, Wendy Smoak <ws...@gmail.com> wrote:

> On Wed, Aug 11, 2010 at 12:49 PM, C. Benson Manica <cb...@gmail.com>
> wrote:
> > How do I use the release plugin to do this automatically?
>
> How are you changing the version elements now?  Does the parent pom
> also have <module>s in it?
>
> It's not yet clear whether the release or versions plugin would work best.
>
> Release plugin docs are here...
> http://maven.apache.org/plugins/maven-release-plugin/
>
> (What version control system are you using?  Make sure you have the
> scm connection urls set in your pom.)
>
> --
> Wendy
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
C. Benson Manica
cbmanica@gmail.com

Re: Parent and child projects share same version

Posted by Wendy Smoak <ws...@gmail.com>.
On Wed, Aug 11, 2010 at 12:49 PM, C. Benson Manica <cb...@gmail.com> wrote:
> How do I use the release plugin to do this automatically?

How are you changing the version elements now?  Does the parent pom
also have <module>s in it?

It's not yet clear whether the release or versions plugin would work best.

Release plugin docs are here...
http://maven.apache.org/plugins/maven-release-plugin/

(What version control system are you using?  Make sure you have the
scm connection urls set in your pom.)

-- 
Wendy

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Parent and child projects share same version

Posted by "C. Benson Manica" <cb...@gmail.com>.
How do I use the release plugin to do this automatically?

On Wed, Aug 11, 2010 at 12:42 PM, Wendy Smoak <ws...@gmail.com> wrote:

> On Wed, Aug 11, 2010 at 12:18 PM, C. Benson Manica <cb...@gmail.com>
> wrote:
> > there appears to be
> > no way to avoid having to manually bump child1's <parent> element so that
> it
> > inherits from the right version of the top-level pom.
>
> The release plugin will do this automatically for you, or you can use
> the versions plugin to update it.
>
> There is an issue in JIRA about automatic child versioning, but it
> seems to be quite complex to implement.
>
> --
> Wendy
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
C. Benson Manica
cbmanica@gmail.com

Re: Parent and child projects share same version

Posted by Wendy Smoak <ws...@gmail.com>.
On Wed, Aug 11, 2010 at 12:18 PM, C. Benson Manica <cb...@gmail.com> wrote:
> there appears to be
> no way to avoid having to manually bump child1's <parent> element so that it
> inherits from the right version of the top-level pom.

The release plugin will do this automatically for you, or you can use
the versions plugin to update it.

There is an issue in JIRA about automatic child versioning, but it
seems to be quite complex to implement.

-- 
Wendy

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org