mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Only treat warnings as errors when compiling with Java 17
This commit is contained in:
parent
5466239210
commit
573934d545
@ -202,11 +202,17 @@ class JavaConventions {
|
|||||||
compile.setSourceCompatibility(SOURCE_AND_TARGET_COMPATIBILITY);
|
compile.setSourceCompatibility(SOURCE_AND_TARGET_COMPATIBILITY);
|
||||||
compile.setTargetCompatibility(SOURCE_AND_TARGET_COMPATIBILITY);
|
compile.setTargetCompatibility(SOURCE_AND_TARGET_COMPATIBILITY);
|
||||||
}
|
}
|
||||||
args.addAll(Arrays.asList("-Werror", "-Xlint:unchecked", "-Xlint:deprecation", "-Xlint:rawtypes",
|
else if (buildingWithJava17(project)) {
|
||||||
"-Xlint:varargs"));
|
args.addAll(Arrays.asList("-Werror", "-Xlint:unchecked", "-Xlint:deprecation", "-Xlint:rawtypes",
|
||||||
|
"-Xlint:varargs"));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean buildingWithJava17(Project project) {
|
||||||
|
return !project.hasProperty("toolchainVersion") && JavaVersion.current() == JavaVersion.VERSION_17;
|
||||||
|
}
|
||||||
|
|
||||||
private void configureSpringJavaFormat(Project project) {
|
private void configureSpringJavaFormat(Project project) {
|
||||||
project.getPlugins().apply(SpringJavaFormatPlugin.class);
|
project.getPlugins().apply(SpringJavaFormatPlugin.class);
|
||||||
project.getTasks().withType(Format.class, (Format) -> Format.setEncoding("UTF-8"));
|
project.getTasks().withType(Format.class, (Format) -> Format.setEncoding("UTF-8"));
|
||||||
|
Loading…
Reference in New Issue
Block a user