getting property values from POM to be used in command line

33 vues
Accéder directement au premier message non lu

Sridhar Iyer

non lue,
5 mai 2015, 15:36:4905/05/2015
à maven-a...@googlegroups.com
Hi
I have properties block in my POM file like this.

<properties>
<hudson.version>2.1.2</hudson.version>
<maven-surefire-plugin.version>2.16</maven-surefire-plugin.version>
<selenium.version>2.43.1</selenium.version>
<selenium-driver.version>2.37.0</selenium-driver.version>
<webdriver.ie64.driver>${settings.localRepository}/org/seleniumhq/selenium/selenium-ie-driver-server-x64/${selenium-driver.version}/selenium-ie-driver-server-x64-${selenium-driver.version}.exe</webdriver.ie64.driver>
<webdriver.ie32.driver>${settings.localRepository}/org/seleniumhq/selenium/selenium-ie-driver-server-32/${selenium-driver.version}/selenium-ie-driver-server-32-${selenium-driver.version}.exe</webdriver.ie32.driver>
</properties>

Suppose if I have to use the value of one of the properties in comand line, how do I do that?

My exact scenario is that I have to set the system variable "webdriver.ie.driver" with the value from the property <webdriver.ie32.driver>. How do I do that?

I tried
mvn install -Dwebdriver.ie.driver=${webdriver.ie32.driver} -->> didn't work
mvn install -Dwebdriver.ie.driver= -Xwebdriver.ie32.driver -->> didn't work

The only thing that works is when I provide the complete path such as C:\.m2\org\selenium\....iedriver.exe in my command line. But I don;t want to use the absolute path because I build my project using the CI tool Hudson which runs my tests across mutiple VMs and I don't have control over this path in all the VMs.

David Bernard

non lue,
8 mai 2015, 09:12:3808/05/2015
à Maven and Scala
Hi,

1. wrong mailing list, this for maven AND scala

2. you can't inject expression to evaluate for properties from command line. But you can create 2 maven profiles (one for ie32 and one for ie64) with properties section where you define webdriver.ie.driver with the value. Then from command line use -Pie32 or -Pie64 to use target profile.

/davidB

--

---
You received this message because you are subscribed to the Google Groups "Maven and Scala" group.
To unsubscribe from this group and stop receiving emails from it, send an email to maven-and-sca...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Répondre à tous
Répondre à l'auteur
Transférer
0 nouveau message