[
https://issues.apache.org/jira/browse/OFBIZ-8119?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15460686#comment-15460686 ]
Taher Alkhateeb commented on OFBIZ-8119:
----------------------------------------
Okay after a little of investigation I realized what you were trying to do with your patch:
{code}
def defaultEncoding = 'UTF-8'
tasks.withType(AbstractCompile)*.options*.encoding = defaultEncoding
tasks.withType(GroovyCompile)*.groovyOptions*.encoding = defaultEncoding
{code}
AbstractCompile is the parent of JavaCompile, GroovyCompile and other compile tasks, and so this code snippet iterates through this compilation syntax to try to enforce the character encoding on all compile tasks.
GroovyCompile has an additional field for GroovyCompileOptions which extends from AbstractCompileOptions. But CompileOptions (java) also extends from AbstractCompileOptions. So the two separate classes need to set the encoding.
Now, I think the following errors are present in the code:
- The default encoding is already UTF-8, not sure that we need to enforce it unless something is wrong in your default encoding options on the OS?
- GroovyCompileOptions setting for encoding is not needed because we aren't running any gradle plugins or compile tasks.
There are two code snippets which you can try, and please tell me if either one works for you. I am listing the two so that if the first one does not work, then we know the problem is OS related in config settings:
{code}
// try this first, if it works, then ignore the second one
tasks.withType(JavaCompile) {
options.encoding = System.getProperty('file.encoding')
}
// if the above does not work, try this
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
{code}
> Character encoding issue found in file build.gradle
> ---------------------------------------------------
>
> Key: OFBIZ-8119
> URL:
https://issues.apache.org/jira/browse/OFBIZ-8119> Project: OFBiz
> Issue Type: Bug
> Components: ALL APPLICATIONS
> Affects Versions: Trunk
> Environment: Window10
> java version "1.8.0_101"
> Reporter: fumiyoshi.to
> Priority: Minor
> Attachments: OFBIZ-8119_CharacterEncodingInBuildFile.patch, build-error.png
>
>
> I cann't build ofbiz when I run gradlew.
> I found utf-8 should be the default character encoding used by the comipiling work.
> eg.
> def defaultEncoding = 'UTF-8'
> tasks.withType(AbstractCompile)*.options*.encoding = defaultEncoding
> tasks.withType(GroovyCompile)*.groovyOptions*.encoding = defaultEncoding
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)