You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Robert Patrick <ro...@oracle.com> on 2015/10/06 22:01:15 UTC

Release plugin behavior anomoly

Hi,

 

I am trying to use the release plugin with a new project where I want the entire project to use a single version number (vs. one version number per module).  I have the single version number part working like this:

 

1.)    In my parent pom, I do the following:

  <groupId>test</groupId>

 <artifactId>snapshots-parent</artifactId>

  <version>1.0.1-SNAPSHOT</version>

  <packaging>pom</packaging>

 

  <properties>

    <my-project-version>${project.version}</my-project-version>

  </properties>



2.)    In my submodule POMs, I do the following:

  <artifactId>snapshots-consumer</artifactId>

 <packaging>jar</packaging>

  <name>snapshots-consumer</name>

 

  <parent>

    <groupId>test</groupId>

    <artifactId>snapshots-parent</artifactId>

    <version>${my-project-version}</version>

    <relativePath>../parent/pom.xml</relativePath>

  </parent>

 

  <dependencies>

    <dependency>

      <groupId>${project.parent.groupId}</groupId>

      <artifactId>snapshots-util</artifactId>

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

    </dependency>

  </dependencies>

 

This all works fine.  Unfortunately, when I run the release plugin's release:prepare goal, it replaces gthe parent version in all of my submodule POMs with the hard-coded value:

  <parent>

    <groupId>test</groupId>

    <artifactId>snapshots-parent</artifactId>

    <version>1.0.1</version>

    <relativePath>../parent/pom.xml</relativePath>

  </parent>

 

It should would be nice if I could figure out a way to get it to not do this.

 

Any thoughts?

Robert

 

Re: Release plugin behavior anomoly

Posted by Vincent Latombe <vi...@gmail.com>.
Hi Robert,

you can't use properties within the project's artifactId or the parent
declaration (except for a few exceptions where it is expected to be
provided by command line, see https://issues.apache.org/jira/browse/MNG-5576
)

I would recommend you to have a look at the maven-release layout on
https://github.com/apache/maven-release. It is implementing the standard
versioning scheme to deal with this with maven.


Vincent

2015-10-06 22:01 GMT+02:00 Robert Patrick <ro...@oracle.com>:

> Hi,
>
>
>
> I am trying to use the release plugin with a new project where I want the
> entire project to use a single version number (vs. one version number per
> module).  I have the single version number part working like this:
>
>
>
> 1.)    In my parent pom, I do the following:
>
>   <groupId>test</groupId>
>
>  <artifactId>snapshots-parent</artifactId>
>
>   <version>1.0.1-SNAPSHOT</version>
>
>   <packaging>pom</packaging>
>
>
>
>   <properties>
>
>     <my-project-version>${project.version}</my-project-version>
>
>   </properties>
>
>
>
> 2.)    In my submodule POMs, I do the following:
>
>   <artifactId>snapshots-consumer</artifactId>
>
>  <packaging>jar</packaging>
>
>   <name>snapshots-consumer</name>
>
>
>
>   <parent>
>
>     <groupId>test</groupId>
>
>     <artifactId>snapshots-parent</artifactId>
>
>     <version>${my-project-version}</version>
>
>     <relativePath>../parent/pom.xml</relativePath>
>
>   </parent>
>
>
>
>   <dependencies>
>
>     <dependency>
>
>       <groupId>${project.parent.groupId}</groupId>
>
>       <artifactId>snapshots-util</artifactId>
>
>       <version>${project.parent.version}</version>
>
>     </dependency>
>
>   </dependencies>
>
>
>
> This all works fine.  Unfortunately, when I run the release plugin's
> release:prepare goal, it replaces gthe parent version in all of my
> submodule POMs with the hard-coded value:
>
>   <parent>
>
>     <groupId>test</groupId>
>
>     <artifactId>snapshots-parent</artifactId>
>
>     <version>1.0.1</version>
>
>     <relativePath>../parent/pom.xml</relativePath>
>
>   </parent>
>
>
>
> It should would be nice if I could figure out a way to get it to not do
> this.
>
>
>
> Any thoughts?
>
> Robert
>
>
>