1

In my spring project, the root pom.xml contain some property

<properties>
    <rev>3.0</rev>
    <changelist>-SNAPSHOT</changelist>
</properties>

It's a multi-module project. These properties are being used in all child pom.xml file throughout the whole project. The pom.xml in child module use these properties like

<parent>
    <groupId>platform</groupId>
    <artifactId>platform-root</artifactId>
    <version>${rev}${changelist}</version>
    <relativePath>../../pom.xml</relativePath>
</parent>

I can modify the default value of that property in terminal by mvn test -Dchangelist=-release

Now, what I want to do is move the default value of those properties to an external file.
How can I do that?

neelrotno
  • 353
  • 1
  • 4
  • 14
  • Check this https://stackoverflow.com/questions/7513319/passing-command-line-arguments-from-maven-as-properties-in-pom-xml – gladiator May 30 '17 at 05:17
  • https://stackoverflow.com/questions/849389/how-to-read-an-external-properties-file-in-maven ? **Where** are the rev and changelist properties used?? –  May 30 '17 at 05:32
  • @RC. I've updated my question. rev and changelist are being used in all child pom. – neelrotno May 30 '17 at 05:55
  • 1
    You can smiply use the `.mvn/maven.config` for that. – khmarbaise May 30 '17 at 07:46
  • @khmarbaise Do you please describe the process a little more (with appropriate example)? – neelrotno May 30 '17 at 08:02
  • Please read the release notes http://maven.apache.org/docs/3.3.1/release-notes.html – khmarbaise May 30 '17 at 08:07
  • then see the linked question: https://stackoverflow.com/questions/849389/how-to-read-an-external-properties-file-in-maven?noredirect=1&lq=1 –  May 30 '17 at 08:23
  • @khmarbaise I'm sure it'll work for me. I've another query. Please don't mind. I don't find any `maven.config` file in my .mvn directory. Do I need to create one? – neelrotno May 30 '17 at 08:53
  • 1
    If you don't have a `.mvn` directory than sure you need to create it... – khmarbaise May 30 '17 at 10:37
  • Thanks, @khmarbaise . My problem solved. – neelrotno May 31 '17 at 04:07

0 Answers0