Open BusyByte opened 9 years ago
Just wanted to throw a me too on this but slightly different. Our app was running on java 1.8 but somehow scalatest was trying to use 1.6 so this was causing a bit of chaos. Then we switched it to not fork and that caused issues with it confusing resource directories, so we actually had to disable ScalaTest...Any ideas?
It would be really nice to fix this issue. If I compare scalatest-maven-plugin: It invokes java using simply 'java' so whatever is set on path will be used: java whereas surefire-plugin use explicit path to invoke the same java as used to run Maven by default: /usr/java/jdk-1.7.0_51-x86_64/jre/bin/java
It will cause trouble on any system which uses more than one JDK and makes scalatest-maven-plugin useless.
So +1 from me to implement this enhancement/fix.
Simplest fix (based on surefire plugin code) would be to take Maven JVM (without introducing new property to be able to customize): // use the same JVM as the one used to run Maven (the "java.home" one) jvmToUse = System.getProperty( "java.home" ) + File.separator + "bin" + File.separator + "java";
Shall I create pull request for this change?
I'd like this to be fixed as well, but it looks like this project is dead. As a workaround put the following line to $HOME/mavenrc_pre.bat
(on Windows)
set PATH=%JAVA_HOME%/bin;%PATH%
Not dead, just in the back burner while we try and get the 3.0 release out the door. We'll be going through all the issues and PRs that have piled up after the 3.0 release.
Good to know that I was wrong!
Any news on this? I'm really looking for a way to have the tests run on a different VM version than maven and/or the compiler. We use some IBM JDK 6 (I know, I know) machines, but most plugins we use don't support JDK 6 (and right so ofc.). This means that I need to run maven on a higher version (i.e. 8), but I want to double check that the tests succeed on jvm version 6. (I actually want to do a matrix build for all jvm versions we target.)
For surefire, this is (easily) done setting the jvm
parameter using a property, but for Scalatest the only workaround I found was this:
https://groups.google.com/forum/#!topic/scalatest-users/-3AZR5Vl85A
The important part from behind the link:
<configuration>
<forkMode>once</forkMode>
<environmentVariables>
<PATH>/site/jdk/jdk1.7.0_17/bin</PATH>
</environmentVariables>
</configuration>
We had a build fail because it was using the java on the path rather than JAVA_HOME. The java on the path was the default for our build server which was Java 6 and our JAVA_HOME was actually Java 8. We had to turn forking off because of this which shouldn't be necessary.
Rather than doing the following in AbstractScalaTestMojo.runForkingOnce: cli.setExecutable("java"); Having a jvm config property and method getEffectiveJvm like in the surefire-plugin (AbstractSurefireMojo) would be appropriate
I briefly looked at implementing it and submitting a pull request but the maven plugin versions are quite a bit different so I'm unsure how to reconcile the differences.