gradle-plugins/gradle/compile/java.gradle

31 lines
712 B
Groovy
Raw Permalink Normal View History

2021-11-09 14:08:25 +01:00
apply plugin: 'java-library'
java {
2023-10-23 16:58:25 +02:00
toolchain {
2024-01-08 00:38:42 +01:00
languageVersion = JavaLanguageVersion.of(21)
2023-10-23 16:58:25 +02:00
}
2021-11-09 14:08:25 +01:00
modularity.inferModulePath.set(true)
2023-05-21 13:16:00 +02:00
withSourcesJar()
2023-05-24 22:42:39 +02:00
withJavadocJar()
2021-11-09 14:08:25 +01:00
}
jar {
manifest {
attributes('Implementation-Version': project.version)
2024-01-08 00:38:42 +01:00
attributes('X-Java-Compiler-Version': JavaLanguageVersion.of(21).toString())
2021-11-09 14:08:25 +01:00
}
}
tasks.withType(JavaCompile) {
2023-10-23 16:58:25 +02:00
options.fork = true
options.forkOptions.jvmArgs += ['-Duser.language=en','-Duser.country=US']
options.compilerArgs.add('-Xlint:all,-fallthrough')
2022-11-10 10:00:21 +01:00
options.encoding = 'UTF-8'
2021-11-09 14:08:25 +01:00
}
2022-11-10 10:00:21 +01:00
tasks.withType(Javadoc) {
2021-11-09 14:08:25 +01:00
options.addStringOption('Xdoclint:none', '-quiet')
2022-11-10 10:00:21 +01:00
options.encoding = 'UTF-8'
2021-11-09 14:08:25 +01:00
}