I've already configured maven-assembly-plugin, that an installation package in the "tar.xz" format is created.
As this package has some redundancy (the same jar files in different paths for different purposes), the proper order of the files in the tar files (i.e., having the same files at the same place) allows good compression ratios afterwards.
Nevertheless, it seems, that this package puts in the files folder by folder, which doesn't allow to gain an optimal result.
Is there a way to reorder the files in the tar file, e.g. by providing a script that returns a properly ordered list of filenames?
pom.xml:
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.acme.myapp</groupId>
<artifactId>myapp</artifactId>
<version>2.8.22.00-SNAPSHOT</version>
</parent>
<artifactId>myapp-distribution</artifactId>
<name>MYAPP Distribution</name>
<description>This is the distribution project of MYAPP</description>
<packaging>pom</packaging>
<dependencies>
<!-- some dependencies -->
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>myapp</finalName>
<descriptors>
<descriptor>delivery/assembly/distribute-install.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
distribute-install.xml:
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>install</id>
<formats>
<format>txz</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<useProjectArtifact>false</useProjectArtifact>
<unpack>true</unpack>
<unpackOptions>
<excludes>
<exclude>libs/</exclude>
</excludes>
</unpackOptions>
<includes>
<include>com.acme.otherpart:otherpart:zip:otherpart</include>
</includes>
</dependencySet>
<dependencySet>
<useProjectArtifact>false</useProjectArtifact>
<outputDirectory>/libs</outputDirectory>
<unpack>true</unpack>
<includes>
<include>com.acme.myapp:backend:zip:backend-libs</include>
</includes>
</dependencySet>
<dependencySet>
<useProjectArtifact>false</useProjectArtifact>
<outputDirectory>/batch</outputDirectory>
<unpack>true</unpack>
<includes>
<include>com.acme.myapp:backend-jee</include>
</includes>
</dependencySet>
<dependencySet>
<useProjectArtifact>true</useProjectArtifact>
<outputDirectory>/</outputDirectory>
<outputFileNameMapping>frontend.war</outputFileNameMapping>
<includes>
<include>com.acme.myapp:frontend:war:*</include>
</includes>
</dependencySet>
</dependencySets>
</assembly>