I'd like to pass some system variables for a Maven build. If i use mvn clean install -Dfirst.variable=value -Dsecond.variable=second.value
everything's fine. But this configuration in the pom.xml
doesn't work:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.3</version>
<executions>
<execution>
<id>tests</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<includes>
<include>**/*Test.java</include>
</includes>
<systemPropertyVariables>
<first.variable>${value}</first.variable>
<second.variable>${second.value}</second.variable>
</systemPropertyVariables>
</configuration>
</execution>
</executions>
</plugin>
I tried to use this config without <id/>
, <phase/>
and <goals>
but it didn't help. Is there a possibility the plugin doesn't run? Even hardcoded values of these variables don't pass. If so, what is a probable solution? Thanks in advance.
You don´t need to create an <execution/>
. The easy way:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<my.property>propertyValue</my.property>
</systemPropertyVariables>
</configuration>
</plugin>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With