Default Compile tasks to use UTF-8 encoding
We also convert the SpringBootPlugin to be .groovy to ease defaulting the encoding to UTF-8. We do not make the file any "more groovy" to leave this to a distinct commit.
This commit is contained in:
		
							parent
							
								
									0ccfba939e
								
							
						
					
					
						commit
						52382f962e
					
				|  | @ -21,6 +21,7 @@ import org.gradle.api.Project; | ||||||
| import org.gradle.api.plugins.ApplicationPlugin; | import org.gradle.api.plugins.ApplicationPlugin; | ||||||
| import org.gradle.api.plugins.BasePlugin; | import org.gradle.api.plugins.BasePlugin; | ||||||
| import org.gradle.api.plugins.JavaPlugin; | 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.agent.AgentPluginFeatures; | ||||||
| import org.springframework.boot.gradle.repackage.RepackagePluginFeatures; | import org.springframework.boot.gradle.repackage.RepackagePluginFeatures; | ||||||
| import org.springframework.boot.gradle.resolve.ResolvePluginFeatures; | import org.springframework.boot.gradle.resolve.ResolvePluginFeatures; | ||||||
|  | @ -46,6 +47,15 @@ public class SpringBootPlugin implements Plugin<Project> { | ||||||
| 		new ResolvePluginFeatures().apply(project); | 		new ResolvePluginFeatures().apply(project); | ||||||
| 		new RepackagePluginFeatures().apply(project); | 		new RepackagePluginFeatures().apply(project); | ||||||
| 		new RunPluginFeatures().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' | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
		Loading…
	
		Reference in New Issue