Uploaded image for project: 'Gradle'
  1. Gradle
  2. GRADLE-2802

Wrapper install/download does not respect -g or --gradle-user-home command line flags


    • Type: Bug
    • Status: Resolved
    • Resolution: Fixed
    • Affects Version/s: 1.6
    • Fix Version/s: 1.7-rc-1
    • Gradle Forums topic Reference:


      See linked forum post.


        forums Gradle Forums created issue -
        ldaley Luke Daley made changes -
        Field Original Value New Value
        Summary Inconsistent handling of -g and -Dgradle.user.home when using the wrapper script Wrapper install/download does not respect -g or --gradle-user-home command line flags
        Affects Version/s 1.6 [ 10671 ]
        Description Basically, read this: [1]http://forums.gradle.org/gradle/topic....

        The reason is probably that the GradleWrapperMain class uses this method to find gradle home (code from gradle REL-1.6):

        private static File gradleUserHome() {
        String gradleUserHome = System.getProperty(GRADLE_USER_HOME_PROPERTY_KEY);
        if (gradleUserHome != null) {
        return new File(gradleUserHome);
        } else if ((gradleUserHome = System.getenv(GRADLE_USER_HOME_ENV_KEY)) != null) {
        return new File(gradleUserHome);
        } else {
        return new File(DEFAULT_GRADLE_USER_HOME);

        This ignores the command line switches completely, and uses the default home if no env nor a sysprop have been defined. This makes that the line from the user guide (chapter 61. Gradle Wrapper, right under example 61.2):

        The __gradlew__ command can be used _exactly_ the same way as the __gradle__ command.

        not really true. (Emphasis in the above quote comes from the user guide as well; 'exactly' is underlined also, but I don't know how to do it in markdown.)

        The problem is also that this wrong gradle home is used to read gradle.properties, which can break the build in an obscure way.

        The method above should use the arguments to see if the path hasn't been specified there.

        [1] http://forums.gradle.org/gradle/topics/inconsistent_handling_of_g_and_dgradle_user_home_on_the_command_line
        See linked forum post.
        ldaley Luke Daley made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 1.7-rc-1 [ 10675 ]
        Resolution Fixed [ 1 ]


          • Assignee:
            forums Gradle Forums
          • Votes:
            0 Vote for this issue
            2 Start watching this issue


            • Created: