You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Markus Meisterernst (JIRA)" <ji...@apache.org> on 2019/03/18 13:58:00 UTC
[jira] [Comment Edited] (MNG-6608) Why can't project.version in
pom.xml be set as a variable?
[ https://issues.apache.org/jira/browse/MNG-6608?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16795033#comment-16795033 ]
Markus Meisterernst edited comment on MNG-6608 at 3/18/19 1:57 PM:
-------------------------------------------------------------------
Even with the flatten-maven-plugin being at work ? Did you have a look into the example project [^revision-test.zip] ?
I checked my local setup, the artifacts get stored in the local Repository / Nexus Repo manager with variables being replaced ...
{code:java}
Reactor POM - flattens the POM in the process-resources Phase and replaces the Properties (e.g. ${revision}) with actual values:
<pluginManagement>
<plugins>
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>1.1.0</version>
<configuration>
</configuration>
<executions>
<!-- enable flattening -->
<execution>
<id>flatten</id>
<phase>process-resources</phase>
<goals>
<goal>flatten</goal>
</goals>
</execution>
<!-- ensure proper cleanup -->
<execution>
<id>flatten.clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
{code}
was (Author: pingid21):
Even with the flatten-maven-plugin being at work ? Did you have a look into the example project [^revision-test.zip] ?
{code:java}
Reactor POM - flattens the POM in the process-resources Phase and replaces the Properties (e.g. ${revision}) with actual values:
<pluginManagement>
<plugins>
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>1.1.0</version>
<configuration>
</configuration>
<executions>
<!-- enable flattening -->
<execution>
<id>flatten</id>
<phase>process-resources</phase>
<goals>
<goal>flatten</goal>
</goals>
</execution>
<!-- ensure proper cleanup -->
<execution>
<id>flatten.clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
{code}
> Why can't project.version in pom.xml be set as a variable?
> ----------------------------------------------------------
>
> Key: MNG-6608
> URL: https://issues.apache.org/jira/browse/MNG-6608
> Project: Maven
> Issue Type: New Feature
> Components: Design, Patterns & Best Practices
> Affects Versions: 3.6.0
> Reporter: chenxiaoyong
> Priority: Major
> Attachments: revision-test.zip
>
>
> we need modify project.version in pom.xml when we merge source code from develope branch to master branch in git. it‘s troublesome!
> Why can't project.version in pom.xml be set as a variable?
> for example:
> {code:xml}
> <project ... >
> <modelVersion>4.0.0</modelVersion>
> <groupId>org.example</groupId>
> <artifactId>example</artifactId>
> <version>${project-version}</version>
> <packaging>jar</packaging>
> <properties>
> <project-version>1.0.0-SNAPSHOT</project-version>
> </properties>
> <profiles>
> <profile>
> <!-- snapshot -->
> <id>dev</id>
> <properties>
> <profiles.active>dev</profiles.active>
> <project-version>1.0.0-SNAPSHOT</project-version>
> </properties>
> <activation>
> <activeByDefault>true</activeByDefault>
> </activation>
> </profile>
> <profile>
> <!-- RELEASE -->
> <id>release</id>
> <properties>
> <profiles.active>release</profiles.active>
> <project-version>1.0.0-RELEASE</project-version>
> </properties>
> </profile>
> </profiles>
>
> </project>
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)