applicationDefaultJvmArgs

applicationDefaultJvmArgs

gradle application插件的文档指出,我可以使用applicationDefaultJvmArgs来配置在启动脚本中编写的JVM启动参数。当使用Spring Boot Gradle插件时,我得到一个名为boot的新发行版,其中还包含启动脚本。不幸的是,他们似乎忽略了applicationDefaultJvmArgs。它们包含以下行:

# Add default JVM options here. You can also use JAVA_OPTS and POCKETKNIFE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""

而我的原始分散包含以下内容:
# Add default JVM options here. You can also use JAVA_OPTS and POCKETKNIFE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-XX:+UseSerialGC" "-XX:MaxHeapFreeRatio=10" "-XX:MinHeapFreeRatio=10" "-Xms32M" "-Xmx128M" "-Dfile.encoding=UTF-8"'

如何在Spring Boot发行版中设置JVM参数?

最佳答案

我想我想通了:将此添加到build.gradle文件:

bootStartScripts {
    defaultJvmOpts = project.applicationDefaultJvmArgs
}

在我看来,它仍然像是个错误,特别是因为bootRun任务使用applicationDefaultJvmArgs

10-06 03:16