You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Peter De Maeyer (Jira)" <ji...@apache.org> on 2020/12/18 21:35: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=17251336#comment-17251336 ]
Peter De Maeyer edited comment on MNG-6608 at 12/18/20, 9:34 PM:
-----------------------------------------------------------------
My observation: for practical purposes, the ci-friendly feature of Maven produces broken POMs.
The POMs are broken because the variables such as ${revision} are not resolved in the deployed POM, which breaks dependent projects.
The workaround is to use the org.codehaus.mojo's maven-flatten-plugin, which even has an option <flattenMode>resolveCiFriendliesOnly</flattenMode> specifically for that purpose.
CI-friendly is a great feature in Maven, I use it all the time, but it's half-baked because it requires an org.codehaus.mojo to make it work.
Without the flatten-maven-plugin, it just doesn't work, which is a shame.
Ideally, the feature would just work without requiring an org.codehaus.mojo plugin.
I'm going to take a stab at fixing this.
was (Author: peterdm):
My observation: for practical purposes, the ci-friendly feature of Maven produces broken POMs.
The POMs are broken because the variables such as ${revision} are not resolved in the deployed POM, which breaks dependent projects.
The workaround is to use the org.codehaus.mojo's maven-flatten-plugin, which even have an option <flattenMode>resolveCiFriendliesOnly</flattenMode> specifically for that purpose.
CI-friendly is a great feature in Maven, I use it all the time, but it's half-baked because it requires an org.codehaus.mojo to make it work.
Without the flatten-maven-plugin, it just doesn't work, which is a shame.
Ideally, the feature would just work without requiring an org.codehaus.mojo plugin.
I'm going to take a stab at fixing this.
> 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
> Assignee: Robert Scholte
> Priority: Major
> Attachments: example.zip, 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
(v8.3.4#803005)