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

 

Reply via email to