I am using Maven surefire plugin to pass run-time parameters to Java run-time test environment. At java code level we're using
String buildId = System.getProperty("bsIosBuildId");
to accept the value in the code.
Maven pom.xml snippet:
https://gist.github.com/laxmikantm/30e77624e579351241b161220a5d0eaa
I have tried various combinations of bsIosBuildId but its not accepting a value from Jenkins. Whereas below mvn command runs all fine from commandline.
mvn clean verify -Dcucumber.options="--tags @test" -DtargetEnv="browserStackEnv" -DbsIosBuildId="blaBla"
Snapshot from Jenkins job
Quick fix is sending the parameters to Maven as command line parameters.
This is how I implemented this. Jenkins Build Configuration
For me the given Plug-Ins for Jenkins didn't work as they should.