Compile my project using java 7, but run my tests in gradle using java 8

I'm currently deploying my war to a WebLogic Server that supports Java 7, but I want to use Java 8.0 in my selenium and JUnit tests

How do I specify 1.7 in my gradle build to compile and build my war while running my tests with 1.8?

Solution

The source and test are divided into two modules

allprojects {
    sourceCompatibility = 1.7
    targetCompatibility = 1.7
}

Use jdk1 8 build will produce 1.7 jar / war Just override it for the test project and set it to 1.8

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

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>