How can I pass VM arguments to gradle from command line. The Gradle Tool option in Idea is working fine ( screehshot attached). I am trying to pass --add-opens to gradle and am aware of -P but it is not working.
The GRADLE VM options from the Idea
When you run gradle test -Darg1=smth , you pass system parameter arg1 to the Gradle JVM, not the test JVM where tests are run. It is designed this way to protect tests from side effects. and run it the same way.
Add VM options for the Gradle project You can specify VM options for your Gradle project using the gradle. properties file. Create or open your Gradle project. In the Project tool window, right-click the project and from the context menu, select New | File.
To run a Gradle command, open a command window on the project folder and enter the Gradle command. Gradle commands look like this: On Windows: gradlew <task1> <task2> … e.g. gradlew clean allTests.
Try to use ./gradlew -Dorg.gradle.jvmargs=-Xmx16g wrapper
, pay attention on -D
, this marks the property to be passed to gradle and jvm. Using -P
a property is passed as gradle project property.
You can use the GRADLE_OPTS environment variable. Here the documentation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With