You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by TenLeftFingers <ja...@gmail.com> on 2013/08/14 11:01:29 UTC

Making parent pom the absolute authority over it's children's versioning

I have a project laid out like this:

+parent-project
 -child-project1
 +child-project2
  -src
  -child-project2.pom
 parent-project.pom
 
The parent defines its own version:
  <version>4.4.5-SNAPSHOT</version>
  
And child-project two has in it's pom:
  <parent>
		  <groupId>com.company.it.apps</groupId>
		  <artifactId>parent-project</artifactId>
		  <version>4.4.5-SNAPSHOT</version>
  </parent>  
  
The issue I'm having is that I want the person doing the builds to only have
to change the <version> in the parent-project. I want the child-projects to
*take* their version from there so that he only has to make one change. But
if I change the child to declare it's own version as:

  <version>${parent.version}</version>

this actually takes it from the version declared in the child .pom. Yet, if
I don't delcare the version in the child pom it won't know which version of
the parent to go for... 

Am I trying to do the impossible? I don't want to have every child's pom
modified to go from SNAPSHOT to release because in reality the projects are
much larger.

Thanks & regards,
Ten



--
View this message in context: http://maven.40175.n5.nabble.com/Making-parent-pom-the-absolute-authority-over-it-s-children-s-versioning-tp5767638.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: Making parent pom the absolute authority over it's children's versioning

Posted by Stephen Connolly <st...@gmail.com>.
This is currently impossible.

The best you can currently do is inherit xpath:/project/version from
xpath:/project/parent/version

The primary historical driver for this requirement is that with some SCM
systems (especially subversion) people can checkout only the child module,
so there would be no way to build the child project without the parent
project being checked out also.

A long standing RFE is to permit inference of xpath:/project/parent/version
provided that there is a pom on disk at the path specified by
xpath:/project/parent/relativePath *and* that project's
xpath:/project/(groupId,artifactId) match the child's
xpath:/project/parent/(groupId,artifactId) my understanding of one of the
blockers for this RFE is that the deployed pom to the remote repository
would need to include at least xpath:/project/parent/version so that legacy
and non-maven clients can parse the pom correctly *and* the GPG signing
issue that plagued Maven 2.1.0 and 2.2.0 resulting from trying to resolve
portions of the pom at run-time before deployment to the remote repository,
resulting in invalid GPG signatures, has still not been fully resolved
(hence the rollback of that "feature" in 2.2.1)

The reality is that the maven release plugin (or the versions maven plugin)
will handle updating the versions for you.



On 14 August 2013 10:01, TenLeftFingers <ja...@gmail.com> wrote:

> I have a project laid out like this:
>
> +parent-project
>  -child-project1
>  +child-project2
>   -src
>   -child-project2.pom
>  parent-project.pom
>
> The parent defines its own version:
>   <version>4.4.5-SNAPSHOT</version>
>
> And child-project two has in it's pom:
>   <parent>
>                   <groupId>com.company.it.apps</groupId>
>                   <artifactId>parent-project</artifactId>
>                   <version>4.4.5-SNAPSHOT</version>
>   </parent>
>
> The issue I'm having is that I want the person doing the builds to only
> have
> to change the <version> in the parent-project. I want the child-projects to
> *take* their version from there so that he only has to make one change. But
> if I change the child to declare it's own version as:
>
>   <version>${parent.version}</version>
>
> this actually takes it from the version declared in the child .pom. Yet, if
> I don't delcare the version in the child pom it won't know which version of
> the parent to go for...
>
> Am I trying to do the impossible? I don't want to have every child's pom
> modified to go from SNAPSHOT to release because in reality the projects are
> much larger.
>
> Thanks & regards,
> Ten
>
>
>
> --
> View this message in context:
> http://maven.40175.n5.nabble.com/Making-parent-pom-the-absolute-authority-over-it-s-children-s-versioning-tp5767638.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Making parent pom the absolute authority over it's children's versioning

Posted by TenLeftFingers <ja...@gmail.com>.
"this actually takes it from the version declared in the child .pom."
By this I mean it takes it from the childs own definition of the parents
version, not the *actual* parent version as declared in the parent.



--
View this message in context: http://maven.40175.n5.nabble.com/Making-parent-pom-the-absolute-authority-over-it-s-children-s-versioning-tp5767638p5767639.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: Making parent pom the absolute authority over it's children's versioning

Posted by TenLeftFingers <ja...@gmail.com>.
Hi Ziga,

That's very nice. When I omit the <version> for the child, the build adopts
whatever is declared for <parent><version>, which reduces the amount of
work I need to do. Thanks for the tip.

Regards,
Ten


On Thu, Aug 15, 2013 at 3:15 PM, Ziga Gregoric [via Maven] <
ml-node+s40175n5767820h97@n5.nabble.com> wrote:

> Ten,
>
> you might not need version in your child pom.xml files, if child pom.xml
> already have parent pom version.
> In my multi module project, with following structure - 4 pom files, 1 for
> the parent, and 3 for modules:
>
> + parent (pom)
> - child1 (jar)
> - child2 (jar)
> - child3 (war)
>
> I'd define version in parent pom, but in childX poms, there will be no
> version defined, apart from parent's version inside
> //project/parent/vesion
>
> Regards,
> Ziga
>
>
> On Wed, Aug 14, 2013 at 4:18 PM, TenLeftFingers <[hidden email]<http://user/SendEmail.jtp?type=node&node=5767820&i=0>>wrote:
>
>
> > Stephen Connolly, thank you. I'm going to look into that plugin and try
> to
> > automate this process during build-time.
> >
> > Joachim Van der Auwera, thanks. I'll use this solution while I learn how
> to
> > implement Stephen Connolly's idea.
> >
> > Best regards,
> > Ten
> >
> >
> > On Wed, Aug 14, 2013 at 2:32 PM, Joachim Van der Auwera [via Maven] <
> > [hidden email] <http://user/SendEmail.jtp?type=node&node=5767820&i=1>>
> wrote:
> >
> > > Istead of editing the parent pom by hand, you could use a maven to do
> > > this for you. This will change all versions in the child
> > > projects/directories as well:
> > >
> > > mvn versions:set -DnewVersion=1.0.0.20-SNAPSHOT
> > >
> > > Kind regards,
> > > Joachim
> > >
> > > On 08/14/2013 11:01 AM, TenLeftFingers wrote:
> > >
> > > > I have a project laid out like this:
> > > >
> > > > +parent-project
> > > >   -child-project1
> > > >   +child-project2
> > > >    -src
> > > >    -child-project2.pom
> > > >   parent-project.pom
> > > >
> > > > The parent defines its own version:
> > > >    <version>4.4.5-SNAPSHOT</version>
> > > >
> > > > And child-project two has in it's pom:
> > > >    <parent>
> > > >  <groupId>com.company.it.apps</groupId>
> > > >  <artifactId>parent-project</artifactId>
> > > >  <version>4.4.5-SNAPSHOT</version>
> > > >    </parent>
> > > >
> > > > The issue I'm having is that I want the person doing the builds to
> only
> > > have
> > > > to change the <version> in the parent-project. I want the
> > child-projects
> > > to
> > > > *take* their version from there so that he only has to make one
> change.
> > > But
> > > > if I change the child to declare it's own version as:
> > > >
> > > >    <version>${parent.version}</version>
> > > >
> > > > this actually takes it from the version declared in the child .pom.
> > Yet,
> > > if
> > > > I don't delcare the version in the child pom it won't know which
> > version
> > > of
> > > > the parent to go for...
> > > >
> > > > Am I trying to do the impossible? I don't want to have every child's
> > pom
> > > > modified to go from SNAPSHOT to release because in reality the
> projects
> > > are
> > > > much larger.
> > > >
> > > > Thanks & regards,
> > > > Ten
> > > >
> > > >
> > > >
> > > > --
> > > > View this message in context:
> > >
> >
> http://maven.40175.n5.nabble.com/Making-parent-pom-the-absolute-authority-over-it-s-children-s-versioning-tp5767638.html
> > > > Sent from the Maven - Users mailing list archive at Nabble.com.
> > > >
> > > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: [hidden email]<
> > http://user/SendEmail.jtp?type=node&node=5767695&i=0>
> > > > For additional commands, e-mail: [hidden email]<
> > http://user/SendEmail.jtp?type=node&node=5767695&i=1>
> > > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [hidden email]<
> > http://user/SendEmail.jtp?type=node&node=5767695&i=2>
> > > For additional commands, e-mail: [hidden email]<
> > http://user/SendEmail.jtp?type=node&node=5767695&i=3>
> > >
> > >
> > >
> > > ------------------------------
> > >  If you reply to this email, your message will be added to the
> discussion
> > > below:
> > >
> > >
> >
> http://maven.40175.n5.nabble.com/Making-parent-pom-the-absolute-authority-over-it-s-children-s-versioning-tp5767638p5767695.html
> > >  To unsubscribe from Making parent pom the absolute authority over
> it's
> > > children's versioning, click here<
> >
> >
> > > .
> > > NAML<
> >
> http://maven.40175.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
>
> > >
> > >
> >
> >
> >
> >
> > --
> > View this message in context:
> >
> http://maven.40175.n5.nabble.com/Making-parent-pom-the-absolute-authority-over-it-s-children-s-versioning-tp5767638p5767703.html
>
> > Sent from the Maven - Users mailing list archive at Nabble.com.
> >
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://maven.40175.n5.nabble.com/Making-parent-pom-the-absolute-authority-over-it-s-children-s-versioning-tp5767638p5767820.html
>  To unsubscribe from Making parent pom the absolute authority over it's
> children's versioning, click here<http://maven.40175.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5767638&code=amFybGF0aHJlaWR5QGdtYWlsLmNvbXw1NzY3NjM4fDEyMDg3OTQ0MDQ=>
> .
> NAML<http://maven.40175.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://maven.40175.n5.nabble.com/Making-parent-pom-the-absolute-authority-over-it-s-children-s-versioning-tp5767638p5767823.html
Sent from the Maven - Users mailing list archive at Nabble.com.

Re: Making parent pom the absolute authority over it's children's versioning

Posted by Ziga GREGORIC <zi...@gmail.com>.
Ten,

you might not need version in your child pom.xml files, if child pom.xml
already have parent pom version.
In my multi module project, with following structure - 4 pom files, 1 for
the parent, and 3 for modules:

+ parent (pom)
- child1 (jar)
- child2 (jar)
- child3 (war)

I'd define version in parent pom, but in childX poms, there will be no
version defined, apart from parent's version inside //project/parent/vesion

Regards,
Ziga


On Wed, Aug 14, 2013 at 4:18 PM, TenLeftFingers <ja...@gmail.com>wrote:

> Stephen Connolly, thank you. I'm going to look into that plugin and try to
> automate this process during build-time.
>
> Joachim Van der Auwera, thanks. I'll use this solution while I learn how to
> implement Stephen Connolly's idea.
>
> Best regards,
> Ten
>
>
> On Wed, Aug 14, 2013 at 2:32 PM, Joachim Van der Auwera [via Maven] <
> ml-node+s40175n5767695h22@n5.nabble.com> wrote:
>
> > Istead of editing the parent pom by hand, you could use a maven to do
> > this for you. This will change all versions in the child
> > projects/directories as well:
> >
> > mvn versions:set -DnewVersion=1.0.0.20-SNAPSHOT
> >
> > Kind regards,
> > Joachim
> >
> > On 08/14/2013 11:01 AM, TenLeftFingers wrote:
> >
> > > I have a project laid out like this:
> > >
> > > +parent-project
> > >   -child-project1
> > >   +child-project2
> > >    -src
> > >    -child-project2.pom
> > >   parent-project.pom
> > >
> > > The parent defines its own version:
> > >    <version>4.4.5-SNAPSHOT</version>
> > >
> > > And child-project two has in it's pom:
> > >    <parent>
> > >  <groupId>com.company.it.apps</groupId>
> > >  <artifactId>parent-project</artifactId>
> > >  <version>4.4.5-SNAPSHOT</version>
> > >    </parent>
> > >
> > > The issue I'm having is that I want the person doing the builds to only
> > have
> > > to change the <version> in the parent-project. I want the
> child-projects
> > to
> > > *take* their version from there so that he only has to make one change.
> > But
> > > if I change the child to declare it's own version as:
> > >
> > >    <version>${parent.version}</version>
> > >
> > > this actually takes it from the version declared in the child .pom.
> Yet,
> > if
> > > I don't delcare the version in the child pom it won't know which
> version
> > of
> > > the parent to go for...
> > >
> > > Am I trying to do the impossible? I don't want to have every child's
> pom
> > > modified to go from SNAPSHOT to release because in reality the projects
> > are
> > > much larger.
> > >
> > > Thanks & regards,
> > > Ten
> > >
> > >
> > >
> > > --
> > > View this message in context:
> >
> http://maven.40175.n5.nabble.com/Making-parent-pom-the-absolute-authority-over-it-s-children-s-versioning-tp5767638.html
> > > Sent from the Maven - Users mailing list archive at Nabble.com.
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [hidden email]<
> http://user/SendEmail.jtp?type=node&node=5767695&i=0>
> > > For additional commands, e-mail: [hidden email]<
> http://user/SendEmail.jtp?type=node&node=5767695&i=1>
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]<
> http://user/SendEmail.jtp?type=node&node=5767695&i=2>
> > For additional commands, e-mail: [hidden email]<
> http://user/SendEmail.jtp?type=node&node=5767695&i=3>
> >
> >
> >
> > ------------------------------
> >  If you reply to this email, your message will be added to the discussion
> > below:
> >
> >
> http://maven.40175.n5.nabble.com/Making-parent-pom-the-absolute-authority-over-it-s-children-s-versioning-tp5767638p5767695.html
> >  To unsubscribe from Making parent pom the absolute authority over it's
> > children's versioning, click here<
> http://maven.40175.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5767638&code=amFybGF0aHJlaWR5QGdtYWlsLmNvbXw1NzY3NjM4fDEyMDg3OTQ0MDQ=
> >
> > .
> > NAML<
> http://maven.40175.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >
> >
>
>
>
>
> --
> View this message in context:
> http://maven.40175.n5.nabble.com/Making-parent-pom-the-absolute-authority-over-it-s-children-s-versioning-tp5767638p5767703.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>

Re: Making parent pom the absolute authority over it's children's versioning

Posted by TenLeftFingers <ja...@gmail.com>.
Stephen Connolly, thank you. I'm going to look into that plugin and try to
automate this process during build-time.

Joachim Van der Auwera, thanks. I'll use this solution while I learn how to
implement Stephen Connolly's idea.

Best regards,
Ten


On Wed, Aug 14, 2013 at 2:32 PM, Joachim Van der Auwera [via Maven] <
ml-node+s40175n5767695h22@n5.nabble.com> wrote:

> Istead of editing the parent pom by hand, you could use a maven to do
> this for you. This will change all versions in the child
> projects/directories as well:
>
> mvn versions:set -DnewVersion=1.0.0.20-SNAPSHOT
>
> Kind regards,
> Joachim
>
> On 08/14/2013 11:01 AM, TenLeftFingers wrote:
>
> > I have a project laid out like this:
> >
> > +parent-project
> >   -child-project1
> >   +child-project2
> >    -src
> >    -child-project2.pom
> >   parent-project.pom
> >
> > The parent defines its own version:
> >    <version>4.4.5-SNAPSHOT</version>
> >
> > And child-project two has in it's pom:
> >    <parent>
> >  <groupId>com.company.it.apps</groupId>
> >  <artifactId>parent-project</artifactId>
> >  <version>4.4.5-SNAPSHOT</version>
> >    </parent>
> >
> > The issue I'm having is that I want the person doing the builds to only
> have
> > to change the <version> in the parent-project. I want the child-projects
> to
> > *take* their version from there so that he only has to make one change.
> But
> > if I change the child to declare it's own version as:
> >
> >    <version>${parent.version}</version>
> >
> > this actually takes it from the version declared in the child .pom. Yet,
> if
> > I don't delcare the version in the child pom it won't know which version
> of
> > the parent to go for...
> >
> > Am I trying to do the impossible? I don't want to have every child's pom
> > modified to go from SNAPSHOT to release because in reality the projects
> are
> > much larger.
> >
> > Thanks & regards,
> > Ten
> >
> >
> >
> > --
> > View this message in context:
> http://maven.40175.n5.nabble.com/Making-parent-pom-the-absolute-authority-over-it-s-children-s-versioning-tp5767638.html
> > Sent from the Maven - Users mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=5767695&i=0>
> > For additional commands, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=5767695&i=1>
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=5767695&i=2>
> For additional commands, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=5767695&i=3>
>
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://maven.40175.n5.nabble.com/Making-parent-pom-the-absolute-authority-over-it-s-children-s-versioning-tp5767638p5767695.html
>  To unsubscribe from Making parent pom the absolute authority over it's
> children's versioning, click here<http://maven.40175.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5767638&code=amFybGF0aHJlaWR5QGdtYWlsLmNvbXw1NzY3NjM4fDEyMDg3OTQ0MDQ=>
> .
> NAML<http://maven.40175.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://maven.40175.n5.nabble.com/Making-parent-pom-the-absolute-authority-over-it-s-children-s-versioning-tp5767638p5767703.html
Sent from the Maven - Users mailing list archive at Nabble.com.

Re: Making parent pom the absolute authority over it's children's versioning

Posted by Joachim Van der Auwera <li...@progs.be>.
Istead of editing the parent pom by hand, you could use a maven to do 
this for you. This will change all versions in the child 
projects/directories as well:

mvn versions:set -DnewVersion=1.0.0.20-SNAPSHOT

Kind regards,
Joachim

On 08/14/2013 11:01 AM, TenLeftFingers wrote:
> I have a project laid out like this:
>
> +parent-project
>   -child-project1
>   +child-project2
>    -src
>    -child-project2.pom
>   parent-project.pom
>   
> The parent defines its own version:
>    <version>4.4.5-SNAPSHOT</version>
>    
> And child-project two has in it's pom:
>    <parent>
> 		  <groupId>com.company.it.apps</groupId>
> 		  <artifactId>parent-project</artifactId>
> 		  <version>4.4.5-SNAPSHOT</version>
>    </parent>
>    
> The issue I'm having is that I want the person doing the builds to only have
> to change the <version> in the parent-project. I want the child-projects to
> *take* their version from there so that he only has to make one change. But
> if I change the child to declare it's own version as:
>
>    <version>${parent.version}</version>
>
> this actually takes it from the version declared in the child .pom. Yet, if
> I don't delcare the version in the child pom it won't know which version of
> the parent to go for...
>
> Am I trying to do the impossible? I don't want to have every child's pom
> modified to go from SNAPSHOT to release because in reality the projects are
> much larger.
>
> Thanks & regards,
> Ten
>
>
>
> --
> View this message in context: http://maven.40175.n5.nabble.com/Making-parent-pom-the-absolute-authority-over-it-s-children-s-versioning-tp5767638.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> 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