You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Lewis, Eric" <Er...@ipi.ch> on 2013/02/15 16:37:25 UTC

Using versions:set fails when the child version is inherited from its parent - why?

Hi

I'm using the versions-maven-plugin during our semi-automated release process to set a version.

However, I have a problem whenever the version of the project is the same as the one in the parent.
Maven 3 shows a warning if the versions are the same, but if I remove the version (which seems reasonable), I get an error from the versions plugin:

Failed to execute goal org.codehaus.mojo:versions-maven-plugin:1.3.1:set (default-cli) on project external-versions: Project version is inherited from parent.


Here's the POM I'm trying to modify:
  <parent>
    <groupId>whatever</groupId>
    <artifactId>my-parent</artifactId>
    <version>1.13.0-SNAPSHOT</version>
    <relativePath />
  </parent>

  <modelVersion>4.0.0</modelVersion>
  <packaging>pom</packaging>
  <artifactId>external-versions</artifactId>
...

And I try to modify it with
mvn org.codehaus.mojo:versions-maven-plugin:1.3.1:set -DnewVersion=1.13.0-SNAPSHOT



If I create an identical version with 
  <parent>
    <groupId>whatever</groupId>
    <artifactId>my-parent</artifactId>
    <version>1.13.0-SNAPSHOT</version>
    <relativePath />
  </parent>

  <modelVersion>4.0.0</modelVersion>
  <packaging>pom</packaging>
  <version>1.13.0-SNAPSHOT</version>
  <artifactId>external-versions</artifactId>

then it works.



What am I doing wrong?

(Yes, what I'm trying to do seems stupid, but I don't want to change the command depending on whether the child inherits the version from its parent or not - besides I don't know how I would find out whether it has its own version or not. Also, sometimes the version is inherited from the parent and sometimes not.)

Best regards,
Eric

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


AW: Using versions:set fails when the child version is inherited from its parent - why?

Posted by "Lewis, Eric" <Er...@ipi.ch>.
Ok, thanks for the clarification.

I was hoping that the plugin would let me know that I'm trying to do something that can't be done (since the result would be identical to the existing POM).
That is: Issue a warning instead of fail the build.

But anyway: How could I find out myself whether the child has a version tag and whether it differs from its parent's version?

Best regards,
Eric

P.S. Thanks for the plugin, it's a real life saver for us!

-----Ursprüngliche Nachricht-----
Von: Stephen Connolly [mailto:stephen.alan.connolly@gmail.com] 
Gesendet: Freitag, 15. Februar 2013 16:48
An: Maven Users List
Betreff: Re: Using versions:set fails when the child version is inherited from its parent - why?

version-maven-plugin assumes that if you don't provide /project/version and
instead rely on /project/parent/version being the default value then *the
child must always have the same version as the parent*.

If the child may have a different version, then you specify the version.

This behaves similarly with update-parent. if you specify a
/project/version then, even if it is the same as /project/parent/version it
will not be updated, but if you don't specify a /project/version then it
will get updated.


On 15 February 2013 15:37, Lewis, Eric <Er...@ipi.ch> wrote:

> Hi
>
> I'm using the versions-maven-plugin during our semi-automated release
> process to set a version.
>
> However, I have a problem whenever the version of the project is the same
> as the one in the parent.
> Maven 3 shows a warning if the versions are the same, but if I remove the
> version (which seems reasonable), I get an error from the versions plugin:
>
> Failed to execute goal org.codehaus.mojo:versions-maven-plugin:1.3.1:set
> (default-cli) on project external-versions: Project version is inherited
> from parent.
>
>
> Here's the POM I'm trying to modify:
>   <parent>
>     <groupId>whatever</groupId>
>     <artifactId>my-parent</artifactId>
>     <version>1.13.0-SNAPSHOT</version>
>     <relativePath />
>   </parent>
>
>   <modelVersion>4.0.0</modelVersion>
>   <packaging>pom</packaging>
>   <artifactId>external-versions</artifactId>
> ...
>
> And I try to modify it with
> mvn org.codehaus.mojo:versions-maven-plugin:1.3.1:set
> -DnewVersion=1.13.0-SNAPSHOT
>
>
>
> If I create an identical version with
>   <parent>
>     <groupId>whatever</groupId>
>     <artifactId>my-parent</artifactId>
>     <version>1.13.0-SNAPSHOT</version>
>     <relativePath />
>   </parent>
>
>   <modelVersion>4.0.0</modelVersion>
>   <packaging>pom</packaging>
>   <version>1.13.0-SNAPSHOT</version>
>   <artifactId>external-versions</artifactId>
>
> then it works.
>
>
>
> What am I doing wrong?
>
> (Yes, what I'm trying to do seems stupid, but I don't want to change the
> command depending on whether the child inherits the version from its parent
> or not - besides I don't know how I would find out whether it has its own
> version or not. Also, sometimes the version is inherited from the parent
> and sometimes not.)
>
> Best regards,
> Eric
>
> ---------------------------------------------------------------------
> 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: Using versions:set fails when the child version is inherited from its parent - why?

Posted by Stephen Connolly <st...@gmail.com>.
version-maven-plugin assumes that if you don't provide /project/version and
instead rely on /project/parent/version being the default value then *the
child must always have the same version as the parent*.

If the child may have a different version, then you specify the version.

This behaves similarly with update-parent. if you specify a
/project/version then, even if it is the same as /project/parent/version it
will not be updated, but if you don't specify a /project/version then it
will get updated.


On 15 February 2013 15:37, Lewis, Eric <Er...@ipi.ch> wrote:

> Hi
>
> I'm using the versions-maven-plugin during our semi-automated release
> process to set a version.
>
> However, I have a problem whenever the version of the project is the same
> as the one in the parent.
> Maven 3 shows a warning if the versions are the same, but if I remove the
> version (which seems reasonable), I get an error from the versions plugin:
>
> Failed to execute goal org.codehaus.mojo:versions-maven-plugin:1.3.1:set
> (default-cli) on project external-versions: Project version is inherited
> from parent.
>
>
> Here's the POM I'm trying to modify:
>   <parent>
>     <groupId>whatever</groupId>
>     <artifactId>my-parent</artifactId>
>     <version>1.13.0-SNAPSHOT</version>
>     <relativePath />
>   </parent>
>
>   <modelVersion>4.0.0</modelVersion>
>   <packaging>pom</packaging>
>   <artifactId>external-versions</artifactId>
> ...
>
> And I try to modify it with
> mvn org.codehaus.mojo:versions-maven-plugin:1.3.1:set
> -DnewVersion=1.13.0-SNAPSHOT
>
>
>
> If I create an identical version with
>   <parent>
>     <groupId>whatever</groupId>
>     <artifactId>my-parent</artifactId>
>     <version>1.13.0-SNAPSHOT</version>
>     <relativePath />
>   </parent>
>
>   <modelVersion>4.0.0</modelVersion>
>   <packaging>pom</packaging>
>   <version>1.13.0-SNAPSHOT</version>
>   <artifactId>external-versions</artifactId>
>
> then it works.
>
>
>
> What am I doing wrong?
>
> (Yes, what I'm trying to do seems stupid, but I don't want to change the
> command depending on whether the child inherits the version from its parent
> or not - besides I don't know how I would find out whether it has its own
> version or not. Also, sometimes the version is inherited from the parent
> and sometimes not.)
>
> Best regards,
> Eric
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>