[GRADLE-3583] Newlines in JAVA_OPTS breaks application plugin shell script in Gradle 3.2 Created: 18/Nov/16  Updated: 23/Nov/16  Resolved: 18/Nov/16

Status: Resolved
Project: Gradle
Affects Version/s: 3.2
Fix Version/s: 3.2.1-rc-1, 3.2.1

Type: Bug
Reporter: Eric Wendelin Assignee: Unassigned
Resolution: Fixed Votes: 0

Known Issue Of:


When using environment variables with newlines, for instance JAVA_OPTS, then the eval command in the generated application script fails.

Expected Behavior
I would expect Java application to start when executing the script.

Current Behavior
The application script fails at eval with:
build/install/myapp/application/bin/myapp: eval: line 2: -Xms400m: not found
build/install/myapp/application/bin/myapp: eval: line 3: -Xmx400m: not found
build/install/myapp/application/bin/myapp: eval: line 4: -classpath: not found
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)

Fails with exit code 1

Steps to Reproduce (for bugs)

$ ./gradlew installDist
$ export JAVA_OPTS="
$ ./build/install/myapp/application/bin/myapp

Your Environment
$ java -version
java version "1.8.0_92"
Java(TM) SE Runtime Environment (build 1.8.0_92-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.92-b14, mixed mode)

$ ./gradlew -v

Gradle 3.2

Build time: 2016-11-14 12:32:59 UTC
Revision: 5d11ba7bc3d79aa2fbe7c30a022766f4532bbe0f

Groovy: 2.4.7
Ant: Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM: 1.8.0_92 (Oracle Corporation 25.92-b14)
OS: Linux 3.16.0-4-amd64 amd64

Worked correctly in Gradle 3.1

Comment by Eric Wendelin [ 18/Nov/16 ]

Resolved by https://github.com/gradle/gradle/commit/b0fb42928c9d95a389962e2252e8efb0fe0b9fde

Generated at Wed Jun 30 12:52:34 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.