How to customize the jvm startup parameters in the gRPC-java startup script

156 Views Asked by At

gRPC-version: 1.7.0

I want to add some JVM startup parameters to the gRPC-java startup script. For example by customizing the CreateStartScripts Task or other methods.

Does anyone know how to do it?

1

There are 1 best solutions below

0
On BEST ANSWER

use defaultJvmOpts variable:

task helloWorldServer(type: CreateStartScripts) {
    mainClassName = 'io.grpc.examples.helloworld.HelloWorldServer'
    applicationName = 'hello-world-server'
    outputDir = new File(project.buildDir, 'tmp')
    classpath = jar.outputs.files + project.configurations.runtime
    defaultJvmOpts = ["-XX:+UseG1GC"]
}

refer: https://docs.gradle.org/current/javadoc/org/gradle/jvm/application/tasks/CreateStartScripts.html