2

I want to change the version of pom file in all the projects based on single common config file.I have the property defined in parent pom file. But tag version cannot be replaced with ${common-project.version} which is defined in properties of parent pom file. Is there way to achieve it.

Please find the example below.

<parent>
        <groupId>com.test</groupId>
        <artifactId>test-project</artifactId>
        <version>11.0.1-SNAPSHOT</version> <!-- PROJECT VERSION -->
        <relativePath>../pom.xml</relativePath>
</parent>

I want to change the 'version' tag in all the projects based on single config file to remove the duplication.

Josip Ivic
  • 3,639
  • 9
  • 39
  • 57
Brinal
  • 172
  • 2
  • 18
  • 1
    Either you use [versions-maven-plugin](http://www.mojohaus.org/versions-maven-plugin/) to handle this or you need to use Maven 3.2.X+ where you can define properties for the version. – khmarbaise Jul 10 '15 at 06:56
  • Thanks @khmarbaise . Sadly project uses Maven 3.0+. Any other alternative please? – Brinal Jul 10 '15 at 07:00
  • possible duplicate of [How to share common properties among several maven projects?](http://stackoverflow.com/questions/1231561/how-to-share-common-properties-among-several-maven-projects) – Tim Biegeleisen Jul 10 '15 at 07:06
  • 1
    If you use Maven 3.0+ you can use versions-maven-plugin. Apart from that if you do release via maven-release-plugin you don't need to change that manually otherwise you are doing something wrong. Is this a multi module project ? – khmarbaise Jul 10 '15 at 07:10
  • the release plugin has an update versions goal as well: http://maven.apache.org/maven-release/maven-release-plugin/update-versions-mojo.html but compared to the versions plugin its quite limited. – wemu Jul 10 '15 at 07:41
  • Write a shell script. – ring bearer Jul 10 '15 at 08:33
  • ${global.version} solved my problem. Thanks to http://stackoverflow.com/questions/10582054/maven-project-version-inheritance-do-i-have-to-specify-the-parent-version and @Yanflea answer. – Brinal Jul 11 '15 at 07:39

0 Answers0