[GRADLE-2673] Gradle shell script corrupts JAVA_HOME environment variable on Windows/Cygwin Created: 07/Feb/13 Updated: 30/Jul/15 Resolved: 30/Jul/15 |
|
Status: | Resolved |
Project: | Gradle |
Affects Version/s: | None |
Fix Version/s: | 2.7-rc-1 |
Type: | Bug | ||
Reporter: | Gradle Forums | Assignee: | Unassigned |
Resolution: | Fixed | Votes: | 1 |
Description |
Hi all, I tried to use the JAVA_HOME environment variable inside a build script to exec the xjc tool from the JDK. This worked fine from the Windows command shell, but failed when called from the Cygwin shell. Apparently, the "gradle" shell script (from the Gradle bin folder) modifies the JAVA_HOME environment variable. The build file (simplified): task printXjcVersion << { The output from the Windows shell: C:\>gradle -q printXjcVersion The output from the Cygwin shell: $ gradle -q printXjcVersion
So the problem is that the cygwin-ified version of JAVA_HOME is useless outside of the starter script. I devised a simple fix for the gradle shell script. The idea is to modify the JAVACMD local variable instead of JAVA_HOME. This works for me. I'm not a shell expert, though. The output from the Cygwin shell with my fix: $ gradle -q printXjcVersion I'm using Gradle 1.4 on Windows. I attached my simple patch. Regards |
Comments |
Comment by Gradle Forums [ 07/Feb/13 ] |
— C:/Projects/Programs/Gradle-1.4/bin/gradle_orig Mon Jan 28 04:47:48 2013
|
Comment by Gradle Forums [ 07/Feb/13 ] |
Thanks Joerg, would you be willing to submit a pull request for this? The file in question is here: [1]https://github.com/gradle/gradle/blob... |
Comment by Gradle Forums [ 07/Feb/13 ] |
Hi Luke, I'm doing this from work and don't have Git nor direct internet access. I suggest you take the patch and use it in whatever way you like. Regards P.S. I'm absolutely planning to learn Git asap because Linus calls me "ugly and stupid" for using Subversion |