For Gradle, it is the following:
usePlugin 'groovy' repositories { mavenCentral() } dependencies { groovy group:'org.codehaus.groovy', name:'groovy', version:'1.7-beta-2' } def defaultEncoding = 'UTF-8' compileJava { options.encoding = defaultEncoding // affects *.java under src/main/java // alternative: "file.encoding" property compileTestJava { options.encoding = defaultEncoding // affects *.java under src/test/java // alternative: "file.encoding" property } compileGroovy { groovyOptions.encoding = defaultEncoding // affects *.groovy under src/main/groovy options.encoding = defaultEncoding // affects *.java under src/main/groovy } compileTestGroovy { groovyOptions.encoding = defaultEncoding // affects *.groovy under src/test/groovy options.encoding = defaultEncoding // affects *.java under src/test/groovy }
Fine that you have these options for compiling, because those are dificult to find!
ReplyDeleteI found a nice shortcut in the gradle-user mailing list (for a subpart of your example)
ReplyDelete----
//setting the groovy source file encoding:
[compileGroovy, compileTestGroovy]*.options*.encoding = 'UTF-8'
----
Sorry, the example should read:
ReplyDelete//setting the groovy source file encoding:
[compileGroovy, compileTestGroovy]*.groovyOptions*.encoding = 'Cp1252'
it seems pretty good. thanks for your feedback.
ReplyDeleteI use
ReplyDelete[compileJava, compileTestJava, compileGroovy, compileTestGroovy]*.options*.encoding = 'UTF-8'