I am using a library and I need to pass some VM parameters on launch (e.g.
java -Dcom.kgasoft.param=true -jar mysoftware.jar). I had some unit tests on Jenkins and they failed, because I wasn’t able to pass these VM params.
[ad]
I tried some Jenkins plugins, but I wasn’t able to achieve the required result. As it turns out I could use surefire plugin’s parameters. So, assuming we use Maven, in my pom file I specified the following in the
builds/plugins
section:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.9</version> <configuration> <argLine>-Dcom.kgasoft.param=true </argLine> </configuration> </plugin>
This did the trick and the unit tests now pass!