You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Markos Fragkakis <ma...@gmail.com> on 2013/06/06 14:09:42 UTC

Maven release plugin

Hi,

I am using the Maven release plugin and I am trying to make a release. When
I am on master (I am using Git) I have SNAPSHOT versions for both my
project (multimodule) and also for my dependencies (also multimodule).

Suppose I want to make a tag from master (skipping the creation of a
branch) where no SNAPSHOTs are used.

This is my simplified pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<artifactId>results</artifactId>
<version>1.2-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Results parent module</name>

<modules>
<module>results-web</module>
<module>results-persistence</module>
<module>results-domain</module>
<module>results-logic</module>
<module>results-logic-api</module>
<module>results-ear</module>
<module>results-configuration</module>
<module>results-rules-ejb</module>
<module>results-rules</module>
<module>results-rest</module>
</modules>

<properties>
<dependency1.version>1.2.3-SNAPSHOT</main.version>
<dependency2.version>3.4.5-SNAPSHOT</main.version>
</properties>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<tagNameFormat>@{project.version}</tagNameFormat>
<autoVersionSubmodules>true</autoVersionSubmodules>
<localCheckout>true</localCheckout>
<pushChanges>false</pushChanges>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.my.project</groupId>
<artifactId>dependency1-domain</artifactId>
<version>${dependency1.version}</version>
</dependency>
<dependency>
<groupId>org.my.project</groupId>
<artifactId>dependency1-enumerations</artifactId>
<version>${dependency1.version}</version>
</dependency>
<dependency>
<groupId>org.my.project</groupId>
<artifactId>dependency1-logic</artifactId>
<version>${dependency1.version}</version>
<type>ejb</type>
</dependency>
<dependency>
<groupId>org.my.project</groupId>
<artifactId>dependency2-domain</artifactId>
<version>${dependency2.version}</version>
</dependency>
<dependency>
<groupId>org.my.project</groupId>
<artifactId>dependency2-enumerations</artifactId>
<version>${dependency2.version}</version>
</dependency>
<dependency>
<groupId>org.my.project</groupId>
<artifactId>dependency2-logic</artifactId>
<version>${dependency2.version}</version>
<type>ejb</type>
</dependency>
</dependencies>
</dependencyManagement>

</project>

If I do:

mvn release:prepare -Darguments="-dependency1.version=1.2.3.0
-Ddependency2.version=3.4.5.0"

That creates a branch that still has SNAPSHOT dependencies:

<properties>
<dependency1.version>1.2.3-SNAPSHOT</main.version>
<dependency2.version>3.4.5-SNAPSHOT</main.version>
</properties>

How would I generate a tag where the part above would be:

<properties>
<dependency1.version>1.2.3.0</main.version>
<dependency2.version>3.4.5.0</main.version>
</properties>

Thank you,

Markos
-- 
Sent from my iPhone

Re: Maven release plugin

Posted by Russell Gold <ru...@gold-family.us>.
Hi Markos,

You need to release your dependencies first (to create the non-snapshot versions) and then update your project POMs to refer to the released versions. Then you can release your main project. It is only when the dependencies are themselves modules in your project and will be released with it that you have the dependency version changed when you release - and even then, you have to do it by using the ${project.version} property.

- Russ

On Jun 6, 2013, at 8:09 AM, Markos Fragkakis <ma...@gmail.com> wrote:

> Hi,
> 
> I am using the Maven release plugin and I am trying to make a release. When
> I am on master (I am using Git) I have SNAPSHOT versions for both my
> project (multimodule) and also for my dependencies (also multimodule).
> 
> Suppose I want to make a tag from master (skipping the creation of a
> branch) where no SNAPSHOTs are used.
> 
> This is my simplified pom.xml:
> 
> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/maven-v4_0_0.xsd">
> <modelVersion>4.0.0</modelVersion>
> 
> <artifactId>results</artifactId>
> <version>1.2-SNAPSHOT</version>
> <packaging>pom</packaging>
> <name>Results parent module</name>
> 
> <modules>
> <module>results-web</module>
> <module>results-persistence</module>
> <module>results-domain</module>
> <module>results-logic</module>
> <module>results-logic-api</module>
> <module>results-ear</module>
> <module>results-configuration</module>
> <module>results-rules-ejb</module>
> <module>results-rules</module>
> <module>results-rest</module>
> </modules>
> 
> <properties>
> <dependency1.version>1.2.3-SNAPSHOT</main.version>
> <dependency2.version>3.4.5-SNAPSHOT</main.version>
> </properties>
> 
> <build>
> <pluginManagement>
> <plugins>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-release-plugin</artifactId>
> <version>2.4.1</version>
> <configuration>
> <tagNameFormat>@{project.version}</tagNameFormat>
> <autoVersionSubmodules>true</autoVersionSubmodules>
> <localCheckout>true</localCheckout>
> <pushChanges>false</pushChanges>
> </configuration>
> </plugin>
> </plugins>
> </pluginManagement>
> </build>
> 
> <dependencyManagement>
> <dependencies>
> <dependency>
> <groupId>org.my.project</groupId>
> <artifactId>dependency1-domain</artifactId>
> <version>${dependency1.version}</version>
> </dependency>
> <dependency>
> <groupId>org.my.project</groupId>
> <artifactId>dependency1-enumerations</artifactId>
> <version>${dependency1.version}</version>
> </dependency>
> <dependency>
> <groupId>org.my.project</groupId>
> <artifactId>dependency1-logic</artifactId>
> <version>${dependency1.version}</version>
> <type>ejb</type>
> </dependency>
> <dependency>
> <groupId>org.my.project</groupId>
> <artifactId>dependency2-domain</artifactId>
> <version>${dependency2.version}</version>
> </dependency>
> <dependency>
> <groupId>org.my.project</groupId>
> <artifactId>dependency2-enumerations</artifactId>
> <version>${dependency2.version}</version>
> </dependency>
> <dependency>
> <groupId>org.my.project</groupId>
> <artifactId>dependency2-logic</artifactId>
> <version>${dependency2.version}</version>
> <type>ejb</type>
> </dependency>
> </dependencies>
> </dependencyManagement>
> 
> </project>
> 
> If I do:
> 
> mvn release:prepare -Darguments="-dependency1.version=1.2.3.0
> -Ddependency2.version=3.4.5.0"
> 
> That creates a branch that still has SNAPSHOT dependencies:
> 
> <properties>
> <dependency1.version>1.2.3-SNAPSHOT</main.version>
> <dependency2.version>3.4.5-SNAPSHOT</main.version>
> </properties>
> 
> How would I generate a tag where the part above would be:
> 
> <properties>
> <dependency1.version>1.2.3.0</main.version>
> <dependency2.version>3.4.5.0</main.version>
> </properties>
> 
> Thank you,
> 
> Markos
> -- 
> Sent from my iPhone

-----------------
Come read my webnovel, Take a Lemon <http://www.takealemon.com>, 
and listen to the Misfile radio play <http://www.gold-family.us/audio/misfile.html>!