Skip to content

Commit

Permalink
Use JDK 16 for javadoc generation
Browse files Browse the repository at this point in the history
This allows using the latest javadoc features (such as a search bar) without
having to the change the lowest Java version supported by the project.
  • Loading branch information
Marcono1234 committed Apr 25, 2021
1 parent 4cbdbe3 commit e745182
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,30 @@ oss {
}
}

def javaVersion = 8
java {
toolchain {
languageVersion = JavaLanguageVersion.of(8)
languageVersion = JavaLanguageVersion.of(javaVersion)
}
}

compileJava {
sourceCompatibility '1.8'
targetCompatibility '1.8'
sourceCompatibility "$javaVersion"
targetCompatibility "$javaVersion"
}

// Use latest JDK for javadoc generation
tasks.withType(Javadoc).configureEach {
javadocTool = javaToolchains.javadocToolFor {
languageVersion = JavaLanguageVersion.of(16)
}
}

javadoc {
// Specify Java version this project uses
// Otherwise would use version of javadoc toolchain by default which could
// cause compilation error mismatch between compileJava and javadoc creation
options.addStringOption('-release', "$javaVersion")
}

dependencies {
Expand Down

0 comments on commit e745182

Please sign in to comment.