-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpom.xml
More file actions
231 lines (228 loc) · 8 KB
/
Copy pathpom.xml
File metadata and controls
231 lines (228 loc) · 8 KB
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
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>jp.seraphyware.example</groupId>
<artifactId>java11browser</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<main.module>java11browser</main.module>
<main.class>jp.seraphyware.example.Java11BrowserMain</main.class>
<releasedir>target/distribute</releasedir>
</properties>
<build>
<plugins>
<!-- osの種類を検出する -->
<plugin>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.7.0</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>detect</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<!-- Java11でビルド -->
<release>11</release>
</configuration>
</plugin>
<!-- https://mvnrepository.com/artifact/pl.project13.maven/git-commit-id-plugin -->
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>4.0.3</version>
<executions>
<execution>
<id>get-the-git-infos</id>
<goals>
<goal>revision</goal>
</goals>
<phase>initialize</phase>
</execution>
</executions>
<configuration>
<failOnNoGitDirectory>false</failOnNoGitDirectory>
</configuration>
</plugin>
<!-- JAR -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<outputDirectory>${project.build.directory}/mods</outputDirectory>
<archive>
<manifest>
<!-- クラスパス形式の実行可能jar時のためにMANIFESTに依存jarのClass-Path追加 -->
<addClasspath>true</addClasspath>
<!-- モジュール時、クラスパスの実行可能jar時のいずれの場合でもエントリポイントとなる -->
<mainClass>${main.class}</mainClass>
</manifest>
<manifestEntries>
<Implementation-Version>${project.version} ${git.commit.id.abbrev}</Implementation-Version>
<Implementation-Vendor><![CDATA[seraphyware]]></Implementation-Vendor>
<Build-SCM-Information>commit: ${git.commit.id.abbrev} branch: ${git.branch}</Build-SCM-Information>
<Build-At>${git.build.time}</Build-At>
</manifestEntries>
</archive>
</configuration>
</plugin>
<!-- 依存するJARのlibへの展開 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.2</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/mods</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
<includeScope>runtime</includeScope>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>1.3.2</version>
</dependency>
</dependencies>
</plugin>
<!-- Mavenからモジュールとして実行できるようにする。 https://www.mojohaus.org/exec-maven-plugin/examples/example-exec-for-java-programs.html
mvn package exec:exec -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<executable>${java.home}/bin/java</executable>
<arguments>
<!-- WebViewのhttps通信時のJava11のバグのため -->
<argument>-Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2</argument>
<argument>-p</argument>
<modulepath />
<argument>-m</argument>
<!-- JARにmainClassを埋め込む状態ではないのでmainClassの指定は必要 -->
<argument>${main.module}/${main.class}</argument>
</arguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<!-- openjfxの依存jarのうち、空のxxxEmptyモジュールについて不要につき削除する -->
<id>copy-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<delete>
<fileset dir="${project.build.directory}/mods">
<include name="javafx-*.jar" />
<exclude name="javafx-*-win.jar" />
<exclude name="javafx-*-mac.jar" />
<exclude name="javafx-*-linux.jar" />
</fileset>
</delete>
</target>
</configuration>
</execution>
<execution>
<!-- 明示的にjlinkを起動してモジュールを含むランタイムを生成する。
mavenのjlinkプラグインでは、openjfxの生成するxxxxEmptyという自動モジュールも依存関係として
認識してしまい、「jlinkでは自動モジュールは使用できません」というエラーになる。
-->
<id>jlink</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<delete dir="${releasedir}.${os.detected.name}" />
<exec executable="${java.home}/bin/jlink" failonerror="true">
<arg value="--module-path" />
<arg value="${project.build.directory}/mods"/>
<arg value="--add-modules" />
<arg value="${main.module}" />
<!-- slf4jのlogback実装はサービスプロバイダなので bind-services
により依存関係を検索する -->
<arg value="--bind-services"/>
<arg value="--no-man-pages" />
<arg value="--no-header-files" />
<arg value="--verbose" />
<arg value="--compress=2"/>
<arg value="--output" />
<arg value="${releasedir}.${os.detected.name}" />
<arg value="--launcher" />
<arg value="${main.module}=${main.module}" />
</exec>
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.openjfx/javafx-controls -->
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>15.0.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.openjfx/javafx-fxml -->
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>15.0.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.openjfx/javafx-web -->
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-web</artifactId>
<version>15.0.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.0-alpha1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/ch.qos.logback/logback-classic -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<!-- 2021/3/12現在、alpha5があるが、こちらはmodule-infoに不足があり動かない。
https://jira.qos.ch/browse/LOGBACK-1491 -->
<version>1.3.0-alpha4</version>
</dependency>
</dependencies>
</project>