|
12 | 12 | </properties>
|
13 | 13 |
|
14 | 14 | <dependencies>
|
15 |
| - <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-compress --> |
| 15 | + <!-- Only dependency is Apache Commons Compress to read .tar files --> |
16 | 16 | <dependency>
|
17 | 17 | <groupId>org.apache.commons</groupId>
|
18 | 18 | <artifactId>commons-compress</artifactId>
|
|
21 | 21 | </dependencies>
|
22 | 22 |
|
23 | 23 | <build>
|
| 24 | + |
| 25 | + <!-- Just put everything in the .jar so it can be distributed as a single file --> |
24 | 26 | <resources>
|
| 27 | + <!-- Default resources location --> |
25 | 28 | <resource><directory>src/main/resources</directory></resource>
|
| 29 | + |
| 30 | + <!-- Include the source code in the .jar --> |
26 | 31 | <resource><directory>src/main/java</directory></resource>
|
| 32 | + |
| 33 | + <!-- |
| 34 | + Include files in src/main/misc/ in the .jar, but also filter them |
| 35 | + (primarily to put the app version as a property for the app to use) |
| 36 | + --> |
27 | 37 | <resource>
|
28 | 38 | <directory>src/main/misc</directory>
|
29 | 39 | <filtering>true</filtering>
|
30 | 40 | </resource>
|
| 41 | + |
| 42 | + <!-- Include the licence file in the .jar --> |
31 | 43 | <resource>
|
32 | 44 | <directory>.</directory>
|
33 | 45 | <includes><include>LICENSE.txt</include></includes>
|
34 | 46 | </resource>
|
35 | 47 | </resources>
|
| 48 | + |
| 49 | + <!-- |
| 50 | + Use the Maven Shade plugin to strip out all unused classes |
| 51 | + and turn everything into a single fat jar. |
| 52 | + --> |
36 | 53 | <plugins>
|
37 | 54 | <plugin>
|
38 | 55 | <groupId>org.apache.maven.plugins</groupId>
|
|
48 | 65 | <finalName>UnityPackageViewer-${project.version}</finalName>
|
49 | 66 | <minimizeJar>true</minimizeJar>
|
50 | 67 |
|
51 |
| - <!-- Choose my MANIFEST.MF as the winner --> |
| 68 | + <!-- |
| 69 | + Apache Compress .jar also has its own MANIFEST.MF file. |
| 70 | + Choose my MANIFEST.MF as the winner |
| 71 | + --> |
52 | 72 | <filters>
|
53 | 73 | <filter>
|
54 | 74 | <artifact>${project.groupId}:${project.artifactId}</artifact>
|
|
65 | 85 | </filters>
|
66 | 86 |
|
67 | 87 | <transformers>
|
| 88 | + <!--Prevents license duplication --> |
68 | 89 | <transformer implementation="org.apache.maven.plugins.shade.resource.ApacheLicenseResourceTransformer"/>
|
| 90 | + <!-- Prepares merged NOTICE --> |
69 | 91 | <transformer implementation="org.apache.maven.plugins.shade.resource.ApacheNoticeResourceTransformer"/>
|
| 92 | + <!--Set the main class in the MANIFEST --> |
70 | 93 | <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
|
71 | 94 | <mainClass>unitypackage.viewer.Main</mainClass>
|
72 | 95 | </transformer>
|
|
0 commit comments