diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/SpringBootPlugin.java b/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/SpringBootPlugin.groovy similarity index 89% rename from spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/SpringBootPlugin.java rename to spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/SpringBootPlugin.groovy index 2c05560cda..37fa1978ad 100644 --- a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/SpringBootPlugin.java +++ b/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/SpringBootPlugin.groovy @@ -21,6 +21,7 @@ import org.gradle.api.Project; import org.gradle.api.plugins.ApplicationPlugin; import org.gradle.api.plugins.BasePlugin; import org.gradle.api.plugins.JavaPlugin; +import org.gradle.api.tasks.compile.Compile; import org.springframework.boot.gradle.agent.AgentPluginFeatures; import org.springframework.boot.gradle.repackage.RepackagePluginFeatures; import org.springframework.boot.gradle.resolve.ResolvePluginFeatures; @@ -46,6 +47,15 @@ public class SpringBootPlugin implements Plugin { new ResolvePluginFeatures().apply(project); new RepackagePluginFeatures().apply(project); new RunPluginFeatures().apply(project); + + // default to UTF-8 encoding + project.tasks.withType(Compile).all { t-> + t.doFirst { + if(!t.options.encoding) { + t.options.encoding = 'UTF-8' + } + } + } } }