How to set and get(JAVA) system property via Maven plugin ?

3,985 views
Skip to first unread message

chiwa kantawong

unread,
Sep 28, 2016, 5:10:56 AM9/28/16
to getgauge
such as 

mvn gauge:execute -Ddev.env.url=http://xxxxxxx/abc


and in the Step Implementation 

can be get by using System.getPropety("dev.env.url");

Right now the result of System.getPropety("dev.env.url") = null


Kashish Munjal

unread,
Sep 29, 2016, 2:14:02 AM9/29/16
to getg...@googlegroups.com
Hi Chiwa,

You can use some other maven plugins like properties-maven-plugin to set system properties. Here's an example project that uses this plugin.

Alternatively, Gauge even supports environments. Looking at the example you have given, we would recommend you to go with this option. You can create multiple environments like dev, qa, etc in your Gauge project and set the url in the properties file within each environment. You can then run something like mvn -Denv=dev gauge:execute to run your tests against the dev env.



--
You received this message because you are subscribed to the Google Groups "getgauge" group.
To unsubscribe from this group and stop receiving emails from it, send an email to getgauge+unsubscribe@googlegroups.com.
To post to this group, send email to getg...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/getgauge/881f6147-b773-414e-aa05-da5c7ce15c41%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Thanks,
Kashish Munjal
Reply all
Reply to author
Forward
0 new messages