3

There is a weird problem which I am not sure about its source.

I am using Intellij IDEA (2016 3.3) and Gradle (v3.3). I use Windows 10, Turkish OS.

Gradle has a wrapper properties file. (./gradle/wrapper/gradle-wrapper.properties)

The content of that file, which is generated by Gradle:

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-bin.zip

When I open a Gradle project in Intellij, the last line of that file turns into this:

distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-b\u0131n.zip

Intellij overwrites bin into b\u0131n. I checked what \u0131 refers to, and it is ASCII code for 'ı' letter.

And because the URL is broken, I can't build the project.

There are a lot of 'i' letter in that file (not mentioning the whole project), but somehow Intellij turns that specific 'i' in 'bin' into ASCI of 'ı'.

I have this problem for long, but for the first time Intellij insists overwriting it when I try to correct the letter manually. The only difference this time is that I created a multiple-modules containing project which means there are more than one gradle-wrapper.properties file.

Do any of you know why and how to solve this?

er-han
  • 1,859
  • 12
  • 20
  • Is "bın" a common Turkish word, and is some kind of spelling correction active? – CodeCaster Feb 14 '17 at 08:42
  • @CodeCaster good point but no, 'bın' is not a meaningful word in Turkish. But 'ı' is a Turkish letter. – er-han Feb 14 '17 at 08:44
  • I've [reported a bug](https://youtrack.jetbrains.com/issue/IDEA-168145) in IntelliJ IDEA issue tracker. It would help if you could attach a sample project to reproduce it. Does it help if you [switch to UTF-8 everywhere](http://blogs.jetbrains.com/idea/2013/03/use-the-utf-8-luke-file-encodings-in-intellij-idea/)? Does it help if you add `-Dfile.encoding=UTF-8` and `-Duser.language=en` into [.vmoptions](https://intellij-support.jetbrains.com/hc/articles/206544869)? – CrazyCoder Feb 14 '17 at 10:02
  • @CrazyCoder thank you, I found out this is not an Intellij IDEA's bug but it is Gradle's. Something about locale lowercasing method. I am adding an answer, so others can use this info. – er-han Feb 14 '17 at 14:23

2 Answers2

4

After some research, I found the origin of the bug and it is not Intellij IDEA but Gradle.

@Input
    public String getDistributionUrl() {
        if (distributionUrl != null) {
            return distributionUrl;
        } else if (gradleVersion != null) {
            return locator.getDistributionFor(gradleVersion, distributionType.name().toLowerCase()).toString();
        } else {
            return null;
        }
    }

https://github.com/gradle/gradle/blob/master/subprojects/build-init/src/main/groovy/org/gradle/api/tasks/wrapper/Wrapper.java#L314

toLowerCase() method in here uses my locale (tr-TR) so the output of "BIN".toLowerCase() is "bın".

I added an issue in Gradle-dev Google group and suggested a solution.

er-han
  • 1,859
  • 12
  • 20
1

In build.gradle, adding;

task wrapper(type: Wrapper) {
    gradleVersion = '3.3'
    distributionUrl = "https://services.gradle.org/distributions/gradle-${gradleVersion}-all.zip"
}

solved it for me.

Check here for further info.

myuce
  • 1,321
  • 1
  • 19
  • 29
  • Thanks for the answer, but thats not necessary anymore. That bug i mentioned was fixed by me and the fix is included now in the latest version of Gradle. – er-han Jun 02 '17 at 06:20