[GRADLE-526] Relative Path in GRADLE_HOME does not work any more Created: 18/Jun/09  Updated: 04/Jan/13  Resolved: 15/Jul/09

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: 0.7

Type: Bug
Reporter: Steve Appling Assignee: Hans Dockter
Resolution: Fixed Votes: 0


If the GRADLE_HOME environment variable is set to a relative path (like ..\tools\gradle) you can get several types of errors. This worked in 0.6, but something has changed in the main trunk since then.

This caused me problems with classpaths in buildsrc (groovyc couldn't find the ant jar) and with junit test execution.

I think that a simple change to BootstrapMain would help:

Index: BootstrapMain.java
--- BootstrapMain.java    (revision 1587)
+++ BootstrapMain.java    (working copy)
@@ -63,12 +63,14 @@
             if (bootStrapDebug) {
                 System.out.println("Gradle Home is declared by environment variable GRADLE_HOME to: " + gradleHome);
-            System.setProperty("gradle.home", gradleHome);
         } else {
             if (bootStrapDebug) {
                 System.out.println("Gradle Home is declared by system property gradle.home to: " + gradleHome);
+        gradleHome = (new File(gradleHome)).getAbsoluteFile().getPath();
+        System.setProperty("gradle.home", gradleHome);
         return gradleHome;

Generated at Wed Jun 30 11:32:21 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.