Open martin-g opened 5 years ago
We're running into this same issue in our CI/CD pipeline. We use Jenkins to build, test, and deploy our application. The jenkins servers have one version of Java installed on the machine, but the build is allowed to specify which version of the build tools should be used (ie: Java, Maven, etc.).
Currently the Jenkins servers have Java 8 installed, but when we specify to build with Java 11 (probably using docker containers) Maven and all the other plugins we use in our project appropriately use Java 11. The scalatest-maven-plugin
does not use Java 11 when it forks. The command it uses is simply java
. In this case, I think the problem is that java on the path is pointing to Java 8, but $JAVA_HOME within the build environment specifies Java 11.
I could have some details wrong here because I don't work on our CI/CD team that manages the pipeline, but this is probably a fair analysis of what is happening. We're getting the exact same error as reported here.
Related, https://github.com/scalatest/scalatest/issues/297, just discovered this as well
I was faced with the same issue until I upgraded to latest scalatest-maven-plugin:2.0.2
.
Could this plugin be made aware of Maven toolchains so that it use the configured JDK in the project ?
My project defines that it should be build (via maven-toolchains-plugin) with JDK 11 but I run
mvn
on the command line whereJAVA_HOME
points to JDK 8 installation and this leads to an error like:Information how a Maven plugin could be made toolchains-aware could be found at: https://cwiki.apache.org//confluence/display/MAVENOLD/Toolchains Here is how scala-maven-plugin does it: https://github.com/davidB/scala-maven-plugin/search?q=ToolchainManager&unscoped_q=ToolchainManager