Use Java 7 to compile my project, but use Java 8 to run my tests in Gradle

I am currently deploying my war on a weblogic server that supports java 7 , but would like to use Java 8 in my selenium and Junit tests .

How can I specify in my Gradle construct to use 1.7 to compile and build my WAR while my tests are running with 1.8 ?

+7
java junit selenium gradle
source share
1 answer

Divide sources and tests into 2 modules. Then indicate each module source and target level:

 allprojects { sourceCompatibility = 1.7 targetCompatibility = 1.7 } 

A building with JDK1.8 will create a bank / war for 1.7. Just override this for your test project and set it to 1.8.

Check this out: compiling-a-project-with-different-java-source-compatibility

0
source share

All Articles