generated from wiverson/maven-jpackage-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pom.xml
330 lines (309 loc) · 15.6 KB
/
pom.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.colordetector</groupId>
<artifactId>color-detector</artifactId>
<version>1.0.1</version>
<!-- This description text is included in the Windows installer by default, see windows-jpackage.txt -->
<description>Color Detector</description>
<properties>
<!-- Set this to the class with the main method for your application -->
<main-class>com.colordetector.BaseApplication</main-class>
<!-- Change your app's name to something interesting... but you might want to avoid spaces
just to safe for compatibility across operating systems. -->
<app.name>ColorDetector</app.name>
<!-- This converts the build timestamp to a Windows-installer friendly version number (minute level resolution).
Note that Maven generated timestamp is in UTC, not local time. For more information see:
https://docs.microsoft.com/en-us/windows/win32/msi/productversion
https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/text/SimpleDateFormat.html
-->
<app.version>1.0.1</app.version>
<app.dir>${user.home}\AppData\Roaming\${app.name}</app.dir>
<!-- This property is used to specify the modules included in the (custom) JVM image. -->
<!-- Reminder: javafx.web (the embedded browser component) is not included in this project by default due
to GitHub template size restrictions. You can download the full SDK from https://openjfx.io -->
<jvm.modules>javafx.media,javafx.controls,javafx.fxml,java.logging</jvm.modules>
<!-- Set the project to UTF-8, avoiding warnings in the build logs -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>18</maven.compiler.source>
<maven.compiler.target>18</maven.compiler.target>
<!-- Replace this UUID with a custom one for your project. This ID is used by the Windows installer system
to know that an installer is intended to replace/upgrade an earlier version. The easiest thing to do is
grab a unique UUID via https://www.uuidgenerator.net -->
<windows.upgrade.uuid>aaaaaaaa-0000-aaaa-aaaa-aaaaaaaaaaaa</windows.upgrade.uuid>
<!-- This is used to set many user-visible fields in the Windows Installer. See windows-jpackage.txt -->
<windows.vendor>Sample</windows.vendor>
<!-- Empty properties to skip signing by default. Set with the macos-sign Maven profile -->
<macos.sign/>
<macos.sign.identity/>
</properties>
<dependencies>
<!-- This dependency is a normal Maven dependency, here mainly as an example. It brings in other transitive
dependencies as well. You can remove it from your project (unless you happen to need to generate test data. -->
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.24</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.github.kwhat/jnativehook -->
<dependency>
<groupId>com.github.kwhat</groupId>
<artifactId>jnativehook</artifactId>
<version>2.2.2</version>
</dependency>
</dependencies>
<build>
<extensions>
<!-- Used to inject the OS and architecture values in a consistent manner -->
<!-- https://github.com/trustin/os-maven-plugin -->
<extension>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.7.0</version>
</extension>
</extensions>
<resources>
<resource>
<!-- Here we are processing the platform-specific jpackage command files, adding in Maven
properties for configuration. -->
<directory>${project.basedir}/src/packaging</directory>
<filtering>true</filtering>
<targetPath>${project.build.directory}/packaging</targetPath>
</resource>
<!-- Add the default resource path back in - by overriding above it disables the default -->
<resource>
<filtering>true</filtering>
<directory>${project.basedir}/src/main/resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<configuration>
<!-- This is an app, so we don't want to install it in the local Maven repository -->
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<!-- This copies the jar files declared by the Maven build into a single directory.
This makes it easy to assemble the final installer package -->
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<!-- Include only compile stage dependencies (no test dependencies) -->
<includeScope>compile</includeScope>
<!-- The JavaFX libraries are bundled into the custom JVM, so we don't want to duplicate
them in the bundled app and installer. This command skips all of the JavaFX by groupId. -->
<excludeGroupIds>org.openjfx</excludeGroupIds>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<!-- Put the application jar generated by the project into the dependency folder - the default folder
for the maven-dependency-plugin output. -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<outputDirectory>${project.build.directory}/dependency</outputDirectory>
</configuration>
</plugin>
<plugin>
<!-- Plugin to make working with JavaFX nicer. See https://github.com/openjfx/javafx-maven-plugin -->
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.8</version>
<configuration>
<mainClass>${main-class}</mainClass>
</configuration>
</plugin>
<plugin>
<!-- https://github.com/wiverson/jtoolprovider-plugin -->
<groupId>io.github.wiverson</groupId>
<artifactId>jtoolprovider-plugin</artifactId>
<version>1.0.34</version>
<executions>
<!-- This command runs jlink, generating a custom JVM by combining the JavaFX modules bundled in
this project with the JDK modules. -->
<execution>
<id>jlink</id>
<phase>package</phase>
<goals>
<goal>java-tool</goal>
</goals>
<configuration>
<toolName>jlink</toolName>
<removeDirectories>${project.build.directory}/jvm-image/</removeDirectories>
<addModules>${jvm.modules}</addModules>
<output>${project.build.directory}/jvm-image</output>
<args>
<arg>--strip-native-commands</arg>
<arg>--no-header-files</arg>
<arg>--strip-debug</arg>
<arg>--no-man-pages</arg>
<arg>--compress=2</arg>
</args>
</configuration>
</execution>
<!-- The command that actually generates the installer. The options for each platform
are found the /src/packaging directory. These files are copied into the target directory by
the Maven resources plugin, which does the filtering to replace the original values with
the actual Maven properties.
https://github.com/wiverson/jtoolprovider-plugin/blob/main/java-tool-doc.md
-->
<execution>
<id>jpackage</id>
<phase>install</phase>
<goals>
<goal>java-tool</goal>
</goals>
<configuration>
<toolName>jpackage</toolName>
<writeOutputToLog>true</writeOutputToLog>
<writeErrorsToLog>true</writeErrorsToLog>
<failOnError>true</failOnError>
<removeDirectories>${project.build.directory}/installer-work</removeDirectories>
<args>@${project.build.directory}/packaging/${os.detected.name}-jpackage.txt</args>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.2.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>3.0.0-M1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.3.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.2.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.10.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
</plugin>
</plugins>
</pluginManagement>
</build>
<profiles>
<profile>
<id>github-action</id>
<activation>
<property>
<name>env.GITHUB_RUN_NUMBER</name>
</property>
</activation>
<properties>
<!--suppress UnresolvedMavenProperty -->
<!-- <app.version>1.${env.GITHUB_RUN_NUMBER}.${env.GITHUB_RUN_ATTEMPT}</app.version> -->
<app.version>1.0.0</app.version>
</properties>
</profile>
<!-- We use the built-in Maven profile activation system to set the platform property.
These properties are then use to build the directory paths to the platform specific resources.
It would be great if Maven automatically added the os family as a property by default
-->
<profile>
<id>macos-sign</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<macos.sign>--mac-sign</macos.sign>
<!-- You will have to replace this with your own dev information from your Apple identity -->
<macos.sign.identity>--mac-signing-key-user-name "Company Name, Inc. (BXPXTXC35S)"</macos.sign.identity>
</properties>
</profile>
<profile>
<id>windows-active</id>
<activation>
<os>
<family>windows</family>
</os>
</activation>
<build>
<plugins>
<plugin>
<!-- This adds a "launch on finish" to the Windows msi installer. This just tweaks the Windows
installer package to run the executable after the installer runs, simplifying the user experience.
If you don't want this behavior, just delete this plug execution. -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<phase>install</phase>
<id>add-launch-to-msi</id>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>cscript</executable>
<outputFile>${project.build.directory}/msi-result.log</outputFile>
<workingDirectory>${project.build.directory}</workingDirectory>
<arguments>
<argument>${project.build.directory}/packaging/add-launch-to-msi.js</argument>
</arguments>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>