user1648825
user1648825

Reputation: 999

Maven command line argument vs pom property

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.

Upvotes: 1

Views: 3509

Answers (1)

OhadR
OhadR

Reputation: 8839

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.

Upvotes: 3

Related Questions