OSDN Git Service

dmg作成時の旧dmg削除のファイル名不一致
[charactermanaj/CharacterManaJ.git] / pom.xml
1 <project xmlns="http://maven.apache.org/POM/4.0.0"
2         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4         <modelVersion>4.0.0</modelVersion>
5
6         <groupId>jp.seraphyware.charactermanaj</groupId>
7         <artifactId>CharacterManaJ</artifactId>
8         <version>0.9.9.9</version>
9
10         <url>https://osdn.net/projects/charactermanaj/</url>
11
12         <scm>
13                 <connection>scm:git:https://scm.osdn.net/gitroot/charactermanaj/CharacterManaJ.git</connection>
14                 <tag>HEAD</tag>
15                 <url>https://osdn.net/projects/charactermanaj/scm/git/CharacterManaJ/</url>
16         </scm>
17
18         <developers>
19                 <developer>
20                         <id>seraphy</id>
21                         <name>seraphy</name>
22                         <email>seraphy@users.osdn.me</email>
23                         <url>https://osdn.net/users/seraphy/</url>
24                         <organization>seraphyware</organization>
25                         <roles>
26                                 <role>architect</role>
27                                 <role>developer</role>
28                         </roles>
29                         <timezone>Asia/Tokyo</timezone>
30                 </developer>
31         </developers>
32
33         <properties>
34                 <mainClass>charactermanaj.CharacterManaJ</mainClass>
35                 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
36                 <maven.compiler.source>1.6</maven.compiler.source>
37                 <maven.compiler.target>1.6</maven.compiler.target>
38                 <animalSnifferArtifact>java16</animalSnifferArtifact>
39                 <animalSnifferArtifactVersion>1.1</animalSnifferArtifactVersion>
40                 <maven.build.timestamp.format>yyyy-MM-dd</maven.build.timestamp.format>
41         </properties>
42
43         <dependencies>
44                 <!-- https://mvnrepository.com/artifact/com.apple/AppleJavaExtensions -->
45                 <dependency>
46                         <groupId>com.apple</groupId>
47                         <artifactId>AppleJavaExtensions</artifactId>
48                         <version>1.4</version>
49                         <scope>provided</scope>
50                 </dependency>
51
52                 <!-- テスト -->
53                 <dependency>
54                         <groupId>junit</groupId>
55                         <artifactId>junit</artifactId>
56                         <version>4.11</version>
57                         <scope>test</scope>
58                 </dependency>
59         </dependencies>
60
61         <build>
62                 <plugins>
63                         <!-- 現在時刻からユニークなビルド番号を生成する
64                                 (使うか否かに関わらず、SCMの設定が必要。
65                                 buildNumberの連番を使う場合はローカルにプロパティファイルが作成される) -->
66                         <plugin>
67                                 <groupId>org.codehaus.mojo</groupId>
68                                 <artifactId>buildnumber-maven-plugin</artifactId>
69                                 <version>1.4</version>
70                                 <executions>
71                                         <execution>
72                                                 <phase>validate</phase>
73                                                 <goals>
74                                                         <goal>create</goal>
75                                                 </goals>
76                                         </execution>
77                                 </executions>
78                                 <configuration>
79                                         <doCheck>false</doCheck>
80                                         <doUpdate>true</doUpdate>
81                                         <format>{0,date,yyyyMM}.{0,date,ddHHmm}</format>
82                                         <items>
83                                                 <item>timestamp</item>
84                                         </items>
85                                 </configuration>
86                         </plugin>
87                         <plugin>
88                                 <!-- コンパイラープラグイン -->
89                                 <groupId>org.apache.maven.plugins</groupId>
90                                 <artifactId>maven-compiler-plugin</artifactId>
91                                 <version>3.1</version>
92                                 <configuration>
93                                         <source>${maven.compiler.source}</source>
94                                         <target>${maven.compiler.target}</target>
95                                         <compilerArgument>-Xlint:all</compilerArgument>
96                                 </configuration>
97                         </plugin>
98                         <plugin>
99                                 <!-- 互換性チェック -->
100                                 <groupId>org.codehaus.mojo</groupId>
101                                 <artifactId>animal-sniffer-maven-plugin</artifactId>
102                                 <version>1.16</version>
103                                 <configuration>
104                                         <signature>
105                                                 <groupId>org.codehaus.mojo.signature</groupId>
106                                                 <artifactId>${animalSnifferArtifact}</artifactId>
107                                                 <version>${animalSnifferArtifactVersion}</version>
108                                         </signature>
109                                         <ignoreDependencies>true</ignoreDependencies>
110                                 </configuration>
111                                 <executions>
112                                         <execution>
113                                                 <id>check-java-api</id>
114                                                 <phase>test</phase>
115                                                 <goals>
116                                                         <goal>check</goal>
117                                                 </goals>
118                                         </execution>
119                                 </executions>
120                         </plugin>
121                         <plugin>
122                                 <!-- 実行可能jar本体のパッケージを行う (package時) -->
123                                 <groupId>org.apache.maven.plugins</groupId>
124                                 <artifactId>maven-jar-plugin</artifactId>
125                                 <version>3.1.0</version>
126                                 <configuration>
127                                         <finalName>${project.artifactId}</finalName>
128                                         <archive>
129                                                 <manifest>
130                                                         <mainClass>${mainClass}</mainClass>
131                                                         <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
132                                                         <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
133                                                 </manifest>
134                                                 <manifestEntries>
135                                                         <!-- 起動時のスプラッシュ画像 -->
136                                                         <SplashScreen-Image>splash.png</SplashScreen-Image>
137                                                         <Build-At>${maven.build.timestamp}</Build-At>
138                                                         <Built-By>${project.developers[0].id}</Built-By>
139                                                         <Build-Timestamp>${maven.build.timestamp}</Build-Timestamp>
140                                                         <Specification-Title>${project.name}</Specification-Title>
141                                                         <Specification-Version>${project.version}</Specification-Version>
142                                                         <Specification-Vendor>${project.organization.name}</Specification-Vendor>
143                                                         <Implementation-Title>${project.name}</Implementation-Title>
144                                                         <Implementation-Version>${project.version}.${buildNumber}</Implementation-Version>
145                                                         <Implementation-Vendor-Id>${project.organization.name}</Implementation-Vendor-Id>
146                                                         <Implementation-Vendor>${project.organization.name}</Implementation-Vendor>
147                                                 </manifestEntries>
148                                         </archive>
149                                 </configuration>
150                         </plugin>
151                 </plugins>
152         </build>
153
154         <profiles>
155                 <profile>
156                         <!-- Windowsの場合のビルド -->
157                         <id>windows-profile</id>
158                         <activation>
159                                 <os>
160                                         <family>windows</family>
161                                 </os>
162                         </activation>
163                         <properties>
164                                 <copyJrePath>${java.home}</copyJrePath>
165                         </properties>
166                         <build>
167                                 <plugins>
168                                         <plugin>
169                                                 <!-- Launch4jによるjarファイルのexe化を行う. http://launch4j.sourceforge.net/docs.html
170                                                         プラグインが1.7.24の場合、使用するのはLaunch4j 3.12 である。
171                                                         https://github.com/lukaszlenart/launch4j-maven-plugin/blob/master/pom.xml -->
172                                                 <groupId>com.akathist.maven.plugins.launch4j</groupId>
173                                                 <artifactId>launch4j-maven-plugin</artifactId>
174                                                 <version>1.7.24</version>
175                                                 <executions>
176                                                         <execution>
177                                                                 <id>l4j-gui</id>
178                                                                 <phase>package</phase>
179                                                                 <goals>
180                                                                         <goal>launch4j</goal>
181                                                                 </goals>
182                                                                 <configuration>
183                                                                         <headerType>gui</headerType>
184                                                                         <outfile>target/${project.artifactId}.exe</outfile>
185                                                                         <jar>target/${project.artifactId}.jar</jar>
186                                                                         <errTitle>Failed to execute the ${project.artifactId}</errTitle>
187                                                                         <icon>icon.ico</icon>
188                                                                         <jre>
189                                                                                 <path>jre</path>
190                                                                                 <minVersion>1.5.0</minVersion>
191                                                                                 <initialHeapSize>64</initialHeapSize>
192                                                                                 <maxHeapSize>128</maxHeapSize>
193                                                                         </jre>
194                                                                         <versionInfo>
195                                                                                 <fileVersion>${project.version}</fileVersion>
196                                                                                 <txtFileVersion>${project.version}.${buildNumber}</txtFileVersion>
197                                                                                 <fileDescription>${project.artifactId} ${project.version} ${buildNumber}</fileDescription>
198                                                                                 <copyright><![CDATA[${maven.build.timestamp} ${project.developers[0].id}]]></copyright>
199                                                                                 <productVersion>${project.version}</productVersion>
200                                                                                 <txtProductVersion>${project.version}</txtProductVersion>
201                                                                                 <productName>${project.artifactId}</productName>
202                                                                                 <internalName>${project.artifactId}</internalName>
203                                                                                 <originalFilename>${project.artifactId}.exe</originalFilename>
204                                                                         </versionInfo>
205                                                                 </configuration>
206                                                         </execution>
207                                                 </executions>
208                                         </plugin>
209                                         <plugin>
210                                                 <groupId>org.apache.maven.plugins</groupId>
211                                                 <artifactId>maven-assembly-plugin</artifactId>
212                                                 <version>2.6</version>
213                                                 <executions>
214                                                         <execution>
215                                                                 <!-- JREつきの配布用zipを生成する -->
216                                                                 <id>create-distribution-with-jre</id>
217                                                                 <phase>package</phase>
218                                                                 <goals>
219                                                                         <goal>single</goal>
220                                                                 </goals>
221                                                                 <configuration>
222                                                                         <finalName>${project.artifactId}_${project.version}_with_JRE</finalName>
223                                                                         <appendAssemblyId>false</appendAssemblyId>
224                                                                         <descriptors>
225                                                                                 <descriptor>src/main/assembly/charactermanaj_with_jre_zip.xml</descriptor>
226                                                                         </descriptors>
227                                                                 </configuration>
228                                                         </execution>
229                                                         <execution>
230                                                                 <!-- JRE無しの配布用zipを生成する -->
231                                                                 <id>create-distribution</id>
232                                                                 <phase>package</phase>
233                                                                 <goals>
234                                                                         <goal>single</goal>
235                                                                 </goals>
236                                                                 <configuration>
237                                                                         <finalName>${project.artifactId}_${project.version}</finalName>
238                                                                         <appendAssemblyId>false</appendAssemblyId>
239                                                                         <descriptors>
240                                                                                 <descriptor>src/main/assembly/charactermanaj_zip.xml</descriptor>
241                                                                         </descriptors>
242                                                                 </configuration>
243                                                         </execution>
244                                                 </executions>
245                                         </plugin>
246                                 </plugins>
247                         </build>
248                 </profile>
249
250                 <profile>
251                         <!-- MAC OSXの場合のビルド -->
252                         <id>osx-profile</id>
253                         <activation>
254                                 <os>
255                                         <family>mac</family>
256                                 </os>
257                         </activation>
258                         <properties>
259                                 <copyJrePath>${java.home}</copyJrePath>
260                         </properties>
261                         <build>
262                                 <plugins>
263                                         <plugin>
264                                                 <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-antrun-plugin -->
265                                                 <groupId>org.apache.maven.plugins</groupId>
266                                                 <artifactId>maven-antrun-plugin</artifactId>
267                                                 <version>1.8</version>
268                                                 <executions>
269                                                         <execution>
270                                                                 <phase>package</phase>
271                                                                 <configuration>
272                                                                         <tasks>
273                                                                                 <delete dir="${project.build.directory}/appbundle" />
274                                                                                 <mkdir dir="${project.build.directory}/appbundle" />
275                                                                                 <copy todir="${project.build.directory}/appbundle">
276                                                                                         <fileset
277                                                                                                 dir="${project.basedir}/src/main/attachment/bundle">
278                                                                                                 <include name="**/*" />
279                                                                                                 <exclude name="**/Info.plist" />
280                                                                                         </fileset>
281                                                                                 </copy>
282                                                                                 <copy todir="${project.build.directory}/appbundle">
283                                                                                         <filterset>
284                                                                                                 <!-- ${project.developers[0].name} だと、うまく変数展開できないため -->
285                                                                                                 <filter token="NSHumanReadableCopyright"
286                                                                                                         value="${maven.build.timestamp} ${project.organization.name} ${project.organization.url}" />
287                                                                                                 <!--  内部用バージョンだが、iosではiTunes ConnectのApp一般情報のバージョンと同一であること。
288                                                                                                         a.b.cの3つに整数が連結された形式が推奨される。 -->
289                                                                                                 <filter token="BundleVersion" value="${project.version}" />
290                                                                                                 <!-- ビルド連番を表す。a.b.cの3つに整数が連結された形式が推奨とされているが、
291                                                                                                         実際は、ただの連番(整数値)で良い。iTunes Connectにアップロードする際に、
292                                                                                                         アップロードするごとに異なる値でなければならないため、連番の類が適当とされる -->
293                                                                                                 <filter token="BundleShortVersionString" value="${buildNumber}" />
294                                                                                         </filterset>
295                                                                                         <fileset
296                                                                                                 dir="${project.basedir}/src/main/attachment/bundle">
297                                                                                                 <include name="**/Info.plist" />
298                                                                                         </fileset>
299                                                                                 </copy>
300                                                                                 <copy
301                                                                                         todir="${project.build.directory}/appbundle/CharacterManaJ.app/Contents/Resources">
302                                                                                         <fileset dir="${project.basedir}">
303                                                                                                 <include name="icon.icns" />
304                                                                                         </fileset>
305                                                                                         <fileset dir="${project.build.directory}">
306                                                                                                 <include name="${project.artifactId}.jar" />
307                                                                                         </fileset>
308                                                                                 </copy>
309
310                                                                                 <chmod dir="${project.build.directory}/appbundle/CharacterManaJ.app/Contents/MacOS"
311                                                                                         perm="a+rx" includes="**/*.sh"/>
312                                                                                 <copy todir="${project.build.directory}/appbundle">
313                                                                                         <fileset dir="${project.basedir}/src/main/attachment">
314                                                                                                 <include name="README_mac.txt"/>
315                                                                                         </fileset>
316                                                                                 </copy>
317
318                                                                                 <delete file="${project.build.directory}/${project.artifactId}_${project.version}.dmg"/>
319                                                                                 <exec executable="hdiutil">
320                                                                                         <arg value="create"/>
321                                                                                         <arg value="-fs"/>
322                                                                                         <arg value="HFS+"/>
323                                                                                         <arg value="-format"/>
324                                                                                         <arg value="UDZO"/>
325                                                                                         <arg value="-srcfolder"/>
326                                                                                         <arg value="${project.build.directory}/appbundle"/>
327                                                                                         <arg value="-volname"/>
328                                                                                         <arg value="${project.artifactId}_${project.version}.dmg"/>
329                                                                                         <arg value="${project.build.directory}/${project.artifactId}_${project.version}.dmg"/>
330                                                                                 </exec>
331                                                                                 <exec executable="hdiutil">
332                                                                                         <arg value="internet-enable"/>
333                                                                                         <arg value="-yes"/>
334                                                                                         <arg value="${project.build.directory}/${project.artifactId}_${project.version}.dmg"/>
335                                                                                 </exec>
336
337                                                                                 <delete dir="${project.build.directory}/appbundle/CharacterManaJ.app/Contents/Plugins/JRE"/>
338                                                                                 <copy todir="${project.build.directory}/appbundle/CharacterManaJ.app/Contents/Plugins/JRE">
339                                                                                         <fileset dir="${copyJrePath}">
340                                                                                                 <include name="**/*"/>
341                                                                                                 <exclude name="man/**"/>
342                                                                                                 <exclude name="demo/**"/>
343                                                                                                 <exclude name="include/**"/>
344                                                                                         </fileset>
345                                                                                 </copy>
346                                                                                 <chmod dir="${project.build.directory}/appbundle/CharacterManaJ.app/Contents/Plugins/JRE"
347                                                                                         perm="a+rx" includes="bin/*"/>
348                                                                                 <delete file="${project.build.directory}/${project.artifactId}_${project.version}_with_jre.dmg"/>
349                                                                                 <exec executable="hdiutil">
350                                                                                         <arg value="create"/>
351                                                                                         <arg value="-fs"/>
352                                                                                         <arg value="HFS+"/>
353                                                                                         <arg value="-format"/>
354                                                                                         <arg value="UDZO"/>
355                                                                                         <arg value="-srcfolder"/>
356                                                                                         <arg value="${project.build.directory}/appbundle"/>
357                                                                                         <arg value="-volname"/>
358                                                                                         <arg value="${project.artifactId}_${project.version}.dmg"/>
359                                                                                         <arg value="${project.build.directory}/${project.artifactId}_${project.version}_with_jre.dmg"/>
360                                                                                 </exec>
361                                                                                 <exec executable="hdiutil">
362                                                                                         <arg value="internet-enable"/>
363                                                                                         <arg value="-yes"/>
364                                                                                         <arg value="${project.build.directory}/${project.artifactId}_${project.version}_with_jre.dmg"/>
365                                                                                 </exec>
366                                                                         </tasks>
367                                                                 </configuration>
368                                                                 <goals>
369                                                                         <goal>run</goal>
370                                                                 </goals>
371                                                         </execution>
372                                                 </executions>
373                                         </plugin>
374                                 </plugins>
375                         </build>
376                 </profile>
377         </profiles>
378 </project>