How to use maven run parameters in the maven project?

mashkurm

I am having a new Maven project and I want to pass parameters through command line..

This is my requirement -

If I pass - install -Dinfra=local then my test should run on local machine

If I pass - install -Dinfra=ip then my test should run on the machine having desired ip.

I just wanted to know how to configure this infra into my project so that I can access that through command line.. Many thanks!

J Fabian Meier

You can define a property in your POM:

<project>
    ...
    <properties>
         <infra>local</infra>
    </properties>
    ...
</project>

Then you can reference it in the POM by using ${infra}. You can overwrite the value of the property through the command line (as in your example).

Also see https://stackoverflow.com/a/13709976/927493

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to use maven project as backend?

How to get maven run parameters from inside a maven-plugin?

How to use properties of one maven project in other maven project

How to use a simple maven project as a dependency in GWT maven project?

How can I use a Maven project as a dependency to another Maven project?

How to run a Maven project from Eclipse?

How to run maven project on jetty in Intellij as in Eclipse?

Maven Run Project

Run project with Spark and maven

How to use Maven assembly plugin with multi module maven project

How to use ffmpeg on Java maven project?

How to Use ASM Library in Maven Project

How to use Maven in my Java Project and Why?

How to use AspectJ for Loggin in a maven project?

How to use a jar file as a library in a maven project

How to use gitlab ci to test if a java maven project can be built and run under multiple jdks platform?

Maven archetype from project with parameters

run main class of Maven project

Jenkins: Build and Run Maven Project

Maven project won't run

How to pass parameters to maven?

MAVEN : Run Multiple Maven Project using Maven Test

How to use a maven project jar in a normal java project

How to run existing maven project in eclipse using mac os X

How to compile maven web project in different version and run in different version

How to run a maven project/main class in netbeans without building first?

How to run Maven project using simple java command

how to run/execute a java code(maven project) outside the IDE

How to run a testng .xml file from batch for a maven project