@@ -80,32 +80,56 @@ javaModulePackaging {
8080 operatingSystem = OperatingSystemFamily.WINDOWS
8181 architecture = MachineArchitecture.X86_64
8282 }
83-
84- primaryTarget(target("macos-14"))
8583}
8684```
8785
8886You can now run _ target-specific_ builds:
8987
90- ```
91- ./gradlew assembleWindows
88+ ``` shell
89+ ./gradlew jpackageWindows
9290```
9391
94- ```
92+ ``` shell
9593./gradlew runWindows
9694```
9795
98- There are some additional configuration options that can be used :
96+ Or, for convenience, let the plugin pick the target fitting the machine you run on :
9997
98+ ``` shell
99+ ./gradlew jpackage
100100```
101+
102+ ``` shell
103+ ./gradlew run
104+ ```
105+
106+ There are some additional configuration options that can be used if needed.
107+ All options have a default. Only configure what you need in addition.
108+
109+ ``` kotlin
101110javaModulePackaging {
102- applicationName();
103- applicationVersion();
104- applicationDescription = ""
105- vendor = "My Company"
106- copyright = "(c) My Company"
107- jpackageResources.setFrom(...);
108- resources.from(...)
111+ // global options
112+ applicationName = " app" // defaults to project name
113+ applicationVersion = " 1.0" // defaults to project version
114+ applicationDescription = " Awesome App"
115+ vendor = " My Company"
116+ copyright = " (c) My Company"
117+ jlinkOptions.addAll(" --no-header-files" , " --no-man-pages" , " --bind-services" )
118+ addModules.addAll(" additional.module.to.include" )
119+ jpackageResources = layout.projectDirectory.dir(" res" ) // defaults to 'src/main/resourcesPackage'
120+ resources.from(layout.projectDirectory.dir(" extra-res" ))
121+ verbose = false
122+
123+ // target specific options
124+ targetsWithOs(" windows" ) {
125+ options.addAll(" --win-dir-chooser" , " --win-shortcut" , " --win-menu" )
126+ appImageOptions.addAll(" --win-console" )
127+ targetResources.from(" windows-res" )
128+ }
129+ targetsWithOs(" macos" ) {
130+ options.addAll(" --mac-sign" , " --mac-signing-key-user-name" , " gradlex" )
131+ singleStepPackaging = true
132+ }
109133}
110134```
111135
0 commit comments