Issue
If we want to clean, build and then run our application, we use ./gradlew clean run
.
run
is part of the Gradle Application plugin.
What we want to achieve is to assign a certain maximum heap size to the application using run
, something similar to ./gradlew clean run -Xmx1G
.
The result should equal running java -Xmx16G -jar /path/to/my/app.jar
.
Is there a way to achieve this?
Edit: Just to make sure, I do not want to increase the build deamons's max heap but the max heap of the application that gets started by gradle.
Solution
As reported in the Installing Gradle documentation for version 4.2.1:
Note that it’s not currently possible to set JVM options for Gradle on the command line.
What you are looking for can be achieved modifying the build.gradle
script. You can do it adding this little code snippet to your build.gradle
file:
tasks.withType(JavaExec) {
jvmArgs = ['-Xmx16g']
}
If you want to configure also the initial Java heap size, add the following code:
tasks.withType(JavaExec) {
jvmArgs = ['-Xms1g', '-Xmx16g']
}
Answered By - araknoid
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.