I am new to Scala and Maven, we are starting to use Scalatest to do pre deployment tests for a Java project. We are using maven-scala-plugin to run the tests, and we want to read some parameters (properties) off the command line to run the test, for example:
mvn test -Dparam1=value1 -Dparam2=value
however the problem is that when we use System.getProperty("param1")
in tests it gives back null
, which should be value1
.
Any advices will be appreciated!
I suspect this is because maven forks the process and creates a new JVM to run the tests in. You can disable forking by running it like mvn -DforkMode=never
.
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