1

I've defined a property in my pom. I can also define it as a command line argument. If I make so, will my property be overridden OR conjugated OR property in pom has a higher priority and a command line argument has no effect?

Thx in advance.

user1648825
  • 979
  • 11
  • 19

1 Answers1

3

If you run it with command-line args, it will override the property-values that are in the pom.xml.

for example, if I have a dependency in my pom:

  <dependency>
    <groupId>org.mockito</groupId>
    <artifactId>mockito-all</artifactId>
    <version>${mockito.version}</version>
    <scope>test</scope>
  </dependency>

...

 <properties>
    <mockito.version>1.9.5</mockito.version>
 </properties>

and then, if I run command:

mvn clean install -Dmockito.version=1111

maven will search for version 1111 (which does not exist, of course). As you say - command line has a higher priority.

OhadR
  • 8,276
  • 3
  • 47
  • 53
  • in addition, see this: http://stackoverflow.com/questions/7513319/maven-command-line-arguments – OhadR Mar 03 '15 at 09:47