in the official documentation it is written that
GRADLE_OPTS: Specifies command-line arguments to use when starting the Gradle client. This can be useful for setting the properties to use when running Gradle.
but when I want to set some (default) command line parameters like --debug or --stacktrace, I get an error. Which happens because GRADLE_OPTS is not about command-line arguments for Gradle, but about arguments for the VM running Gradle (like -Xmx512m).
WORKS: GRADLE_OPTS="-Xmx512m" gradlew assemble
FAILS: GRADLE_OPTS="–debug" gradlew assemble
So I think the official documentation is quite misleading and should be fixed.
But besides this, is there any way to accomplish what is actually described in the documentation, namely to define the command-line arguments for Gradle as environment variable?
Background is that I want to integrate the Gradle command into our continuous integration environment (GoCD), and there, the simplest way is just to invoke the “./gradlew” command, but I don’t want to repeat the standard Gradle command line parameters like:
for any command. I would like to store this as environment variable. And I don’t want to make myself dependent on GoCD and implement a custom plugin…