grpcjava-opts

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


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?


Solution

  • 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