Gradle commandline pass org.gradle.jvmargs

Viewed 1939

How can I pass this params to gradle command

e.g.

./gradlew clean build org.gradle.jvmargs=-Xmx2g -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

gives error as

* What went wrong:
Task 'org.gradle.jvmargs=-Xmx2048m' not found in root project

1 Answers

What you have written works if you put it in a gradle.properties file. If you want to use it on the command line, you first have to add a -D (see command line interface in the user guide) but also quote the argument as it contains spaces. E.g.

./gradlew clean build "-Dorg.gradle.jvmargs=-Xmx2g -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError" -Dfile.encoding=UTF-8
Related