Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pass parameters to maven build using pom.xml? [duplicate]

I wanted pass maven command line parameter to POM.xml so that i can use those value for some other purpose in building purpose.

like image 694
Gautam Avatar asked Jun 13 '14 13:06

Gautam


People also ask

How do I pass a parameter in maven?

Passing an Argument to MavenMaven will use the value (2.5) passed as an argument to replace the COMMON_VERSION_CMD property set in our pom. xml. This is not limited to the package command — we can pass arguments together with any Maven command, such as install, test, or build.

How do I set system properties in POM xml?

To provide System Properties to the tests from command line, you just need to configure maven surefire plugin and use -D{systemproperty}={propertyvalue} parameter in commandline. Run Single Test with Maven : $ mvn test -Dtest=MessageUtilTest#msg_add_test -Dmy_message="Hello, Developer!"

Can we have multiple pom xml?

Yes you can use Maven Profiles to manage this. Obviously you can tweak this approach to suit your needs however works best.


1 Answers

mvn install "-Dsomeproperty=propety value" 

In pom.xml:

<properties>     <someproperty> ${someproperty} </someproperty> </properties> 

Referred from this question

like image 142
coreJavare Avatar answered Sep 18 '22 08:09

coreJavare