@@ -53,11 +53,11 @@ val jlink = tasks.register<JlinkTask>(JlinkTask.DEFAULT_TASK_NAME) {
5353
5454 options = listOf (" --strip-debug" , " --no-header-files" , " --no-man-pages" , " --ignore-modified-runtime" , " --generate-cds-archive" )
5555 modules = listOf (
56- " java.instrument" , // for JUnit
57- " java.management" , // for OpenTelemetry
58- " java.naming" , // for Logback
59- " java.sql" , // for Tika
60- " jdk.unsupported" // for Gson
56+ " java.instrument" , // for JUnit
57+ " java.management" , // for OpenTelemetry
58+ " java.naming" , // for Logback
59+ " java.sql" , // for Tika
60+ " jdk.unsupported" // for Gson
6161 )
6262 includeModulePath = false
6363 javaCompiler = javaToolchains.compilerFor(java.toolchain)
@@ -98,16 +98,24 @@ tasks.test {
9898 }
9999}
100100
101+ application {
102+ mainClass = " com.github.stickerifier.stickerify.runner.Main"
103+ applicationDefaultJvmArgs = listOf (" --enable-final-field-mutation=ALL-UNNAMED" )
104+ }
105+
101106val openTelemetryAgent = tasks.register<DownloadOpenTelemetryAgentTask >(DownloadOpenTelemetryAgentTask .DEFAULT_TASK_NAME ) {
102107 description = " Downloads the OpenTelemetry agent for the distribution package."
103108
104109 version = libs.versions.opentelemetry.get()
105110 destinationFile = layout.buildDirectory.file(" openTelemetryAgent/opentelemetry-javaagent.jar" )
106111}
107112
108- application {
109- mainClass = " com.github.stickerifier.stickerify.runner.Main"
110- applicationDefaultJvmArgs = listOf (" --enable-final-field-mutation=ALL-UNNAMED" , " -javaagent:" + openTelemetryAgent.get().destinationFile.get().asFile.name)
113+ tasks.named<CreateStartScripts >(ApplicationPlugin .TASK_START_SCRIPTS_NAME ) {
114+ val agentJarName = openTelemetryAgent.get().destinationFile.get().asFile.name
115+ defaultJvmOpts = (defaultJvmOpts ? : emptyList()) + " -javaagent:$agentJarName "
116+
117+ (unixStartScriptGenerator as TemplateBasedScriptGenerator ).template = resources.text.fromFile(" src/main/resources/customUnixStartScript.txt" )
118+ (windowsStartScriptGenerator as TemplateBasedScriptGenerator ).template = resources.text.fromFile(" src/main/resources/customWindowsStartScript.txt" )
111119}
112120
113121distributions {
@@ -118,8 +126,3 @@ distributions {
118126 }
119127 }
120128}
121-
122- tasks.named<CreateStartScripts >(ApplicationPlugin .TASK_START_SCRIPTS_NAME ) {
123- (unixStartScriptGenerator as TemplateBasedScriptGenerator ).template = resources.text.fromFile(" src/main/resources/customUnixStartScript.txt" )
124- (windowsStartScriptGenerator as TemplateBasedScriptGenerator ).template = resources.text.fromFile(" src/main/resources/customWindowsStartScript.txt" )
125- }
0 commit comments