gradle scrpt breaks JAVA_HOME environment setting
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gradle (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
The script at:
> ls -l /usr/share/
-rwxr-xr-x 1 root root 5114 Sep 9 2013 /usr/share/
incorretly overrides the setting of the JAVA_HOME environment variable at line 70. Simply assuming it's OK to override JAVA_HOME is bad form. Also, why check in the very next line if it's been set? It looks like someone added duct tape with that export statement. At the very least, it shold NOT alter the value if it was set priror to runnig the script. e.g. someting like:
```
> diff /usr/share/
70c70
< export JAVA_HOME=
---
> export JAVA_HOME=
```
Snip from /usr/share/
```
export JAVA_HOME=
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_
# IBM's JDK on AIX uses strange locations for the executables
else
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
```
ProblemType: Bug
DistroRelease: Ubuntu 14.04
Package: gradle 1.4-2ubuntu1
ProcVersionSign
Uname: Linux 3.13.0-103-generic x86_64
ApportVersion: 2.14.1-0ubuntu3.21
Architecture: amd64
Date: Thu Dec 1 21:05:57 2016
Ec2AMI: ami-9a29cea9
Ec2AMIManifest: (unknown)
Ec2Availability
Ec2InstanceType: c3.large
Ec2Kernel: unavailable
Ec2Ramdisk: unavailable
PackageArchitec
SourcePackage: gradle
UpgradeStatus: No upgrade log present (probably fresh install)