On 29/04/2011, at 11:51 PM, Magnus Rundberget wrote:
> Little update...
>
> Looking at the ant jar task, it uses UTF-8 as the default encoding.
> So setting System.setProperty('file.encoding', 'UTF-8') in the root project
> build.gradle file seemed to do the trick.
>
> However this begs the question... wouldn't it be a sensible default for the
> gradle jar task to use UTF-8 ?
For encoding file and directory names, yes. Could you add a jira issue for this?
>
> cheers
> Magnus
>
> From: [email protected]
> To: [email protected]
> Date: Fri, 29 Apr 2011 12:46:26 +0000
> Subject: RE: [gradle-user] Re: file encoding for jar task
>
> Doing the following produces proper filenames though:
>
> task myJar {
> doLast {
> ant.jar(baseDir: sourceSets.main.classesDir,
> destFile:file('build/libs/myjar.jar'))
> }
> }
>
> However this is obviously not a preferred solution...
>
> cheers
> Magnus
>
> From: [email protected]
> To: [email protected]
> Date: Fri, 29 Apr 2011 11:34:57 +0000
> Subject: RE: [gradle-user] Re: file encoding for jar task
>
> I've tried the following:
> 1) On the command line: export JAVA_TOOL_OPTIONS=-Dfile.encoding=ISO-8859-1
> 2) On command line : export JAVA_OPTS=-Dfile.encoding=ISO-8859-1
> 3) in gradle startup script setting -Dfile.options in JAVA_OPTS
> 4) in root build.gradle System.setProperty('file.encoding', 'ISO-8859-1')
>
>
> println outputs the correct encoding but to no avail for the jar task. I'm
> baffled :.-)
>
> I can get the compile working by setting compile dependency to the classes
> dir, but thats obviously not helping much when the produced jar is containing
> class files with messed up names.
>
>
> cheers
> Magnus
>
>
> > Date: Fri, 29 Apr 2011 04:20:05 -0700
> > From: [email protected]
> > To: [email protected]
> > Subject: [gradle-user] Re: file encoding for jar task
> >
> >
> > Magnus Rundberget-3 wrote:
> > >
> > > So I'm guessing that the jar task (extending copy ?) doesn't use the
> > > encoding it should.. and I can't find any setting for the jar task that I
> > > could use to specify the encoding either. Is there something obvious I'm
> > > missing?
> > >
> >
> > I don't think the Jar task has such a setting at the moment. Have you tried
> > setting the JVM's default encoding to iso-8859-1? After all, other parts of
> > the build (compiler etc.) will also need to use this encoding. What's the
> > output of 'println System.getProperty("file.encoding")' ?
> >
> > --
> > Peter Niederwieser
> > Developer, Gradle
> > http://www.gradle.org
> > Trainer & Consultant, Gradleware
> > http://www.gradleware.com
> > Creator, Spock Framework
> > http://spockframework.org
> >
> > --
> > View this message in context:
> > http://gradle.1045684.n5.nabble.com/file-encoding-for-jar-task-tp4358462p4358512.html
> > Sent from the gradle-user mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe from this list, please visit:
> >
> > http://xircles.codehaus.org/manage_email
> >
> >
--
Adam Murdoch
Gradle Co-founder
http://www.gradle.org
VP of Engineering, Gradleware Inc. - Gradle Training, Support, Consulting
http://www.gradleware.com