Hello everyone, :-)

ehm, okay, forget it. I found the solution. I need the following configuration 
for the surefire plugin:

<configuration>
        <jvm>C:\Program Files\jdk1.7.0_80\bin\java</jvm>
</configuration>

The "forkCount" has to be 1. 0 would use the current JVM. As 1 is the default 
value it is not necessary to configure it (at least in my case).


Regards,
Gerrit

-----Ursprüngliche Nachricht-----
Von: Hohl, Gerrit [mailto:[email protected]] 
Gesendet: Dienstag, 27. Oktober 2015 17:21
An: [email protected]
Betreff: Configuration of Java used for surefire plugin / JUnit tests

Hello everyone, :-)

 

I have a Jenkins based build server on which different version of Java are 
installed for different builds (for older versions of our software).

I can control the Java version used by the compiler plugin as well as by 
javadoc plugin.

But I haven't found a way to control the Java version used by the surefire 
plugin for the JUnit tests.

 

Example:

The default Java is 8 while Java 7 should be used as target for the build.

 

For the compiler plugin I can configure the following:

<configuration>

                <source>1.7</source>

                <target>1.7</target>

                <executable>C:\Program
Files\Java\jdk1.7.0_80\bin\javac</executable>

</configuration>

 

For the javadoc plugin I can configure the following:

<configuration>

                <javadocExecutable>C:\Program 
Files\Java\jdk1.7.0_80\bin\javadoc</javadocExecutable>

</configuration>

 

And both configurations work. The classes will be Java 1.7 classes. And Javadoc 
e.g. doesn't need that "-doclint" parameter (otherwise it will fail because of 
malformed HTML code in the Javadoc comments for some reason).

But if the Maven is started using Java 1.8 the JUnit tests will be performed 
Java 1.8.

Unfortunately a few of the standard classes behave differently in 1.8 than in 
1.7 (e.g. JAXB).

So I want them executed also using Java 1.7.

 

About why Maven is started using Java 1.8: Because it is the default Java of 
the machine and I want to configure everything within Maven and nothing outside 
(e.g. in Jenkins).

 

Any ideas?

 

Regards,

Gerrit

 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to