Hello,
I am running builds on Gradle 3.3 running in Java 1.7
The compilations themselves are done in a different version of Java (1.6) using the following:
tasks.withType(JavaCompile) {
options.fork = true
options.forkOptions.executable = "C:/WebSphere8/AppServer/java/bin/javac.exe"
sourceCompatibility = JavaVersion.VERSION_1_6
targetCompatibility = JavaVersion.VERSION_1_6
}
My problem is that in my JAR task, I want to specify the version of Java being used to compile the JAR, not the version of Java that Gradle is using to run atop.
If I attempt to use the following in my manifest, it pulls in the Java 1.7 version
manifest {
attributes (
'Created-By': System.getProperty('java.version') + ' (' + System.getProperty('java.vendor') + ')'
)
}
Does anyone know a way of obtaining the forked Java version?
Note: The above samples are overly simplified. I know I set the fork up in the first place, so I could hard code the Created-By value, but that’s not what I need. I just need to report the forked compiler version in the Manifest.