Skip to content

Commit 8652c04

Browse files
committed
updated source/target compatibility options to use java 1.7, ending support for 1.6. Also updated the JAVA_JRE_7 env variable for the finding jars for the boot class path.
1 parent 5fd738d commit 8652c04

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

gradle/common-java.gradle

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,27 @@ import org.gradle.api.tasks.testing.logging.TestExceptionFormat;
2727

2828
apply plugin: 'java'
2929

30-
def java6JreDir = System.env.'JAVA_JRE_6'
31-
if (java6JreDir) {
32-
def requiredJava6Archives = ["rt.jar", "jsse.jar"]
30+
def java7JreDir = System.env.'JAVA_JRE_7'
31+
if (java7JreDir) {
32+
def requiredJavaBootArchives = ["rt.jar", "jsse.jar"]
3333
def bootClasspath = ""
34-
requiredJava6Archives.each { a ->
35-
def archivePath = new File(java6JreDir, "lib/$a")
34+
requiredJavaBootArchives.each { a ->
35+
def archivePath = new File(java7JreDir, "lib/$a")
3636
if (!archivePath.exists()) {
37-
throw new ProjectConfigurationException("Archive $archivePath required for building in Java 6 could not be found.", null)
37+
throw new ProjectConfigurationException("Archive $archivePath required for building in Java 7 could not be found.", null)
3838
}
3939
logger.info "Archive '$archivePath' added to boot class path"
4040
bootClasspath += "$archivePath;"
4141
}
4242
tasks.withType(JavaCompile) {
43-
sourceCompatibility = 1.6
44-
targetCompatibility = 1.6
43+
sourceCompatibility = 1.7
44+
targetCompatibility = 1.7
4545
options.bootClasspath = bootClasspath
4646
}
4747
} else {
48-
logger.warn "Environment variable 'JAVA_JRE_6' is not defined - falling back to use machine default Java SDK"
48+
// FIXME this warning only makes sense if the JDK version being used is > 1.7.
49+
// FIXME if this warning makes sense, it should be fatal if this is intended for release
50+
logger.warn "IMPORTANT: Environment variable 'JAVA_JRE_7' is not defined - Install JRE 7 and set 'JAVA_JRE_7' to prevent runtime compatibility issues!"
4951
}
5052

5153
if (hasProperty("JDKToUse")) {
@@ -63,6 +65,7 @@ if (hasProperty("JDKToUse")) {
6365
tasks.withType(AbstractCompile) {
6466
options.with {
6567
fork = true
68+
// FIXME forkOptions.executable is deprecated
6669
forkOptions.executable = javaExecutables.javac
6770
}
6871
}

0 commit comments

Comments
 (0)