Вы можете построить банку, используя Maven Assembly Plugin.
Во-первых, вам нужно добавить некоторую информацию, pom.xml плагинов раздел, чтобы сделать результирующую банку исполняемым:
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>com.example.installer.Installer</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
Я рекомендую использовать отдельный assembly descriptor для создания фактического установки баночка. Вот пример:
<assembly>
<id>installer</id>
<formats>
<format>jar</format>
</formats>
<baseDirectory></baseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory>/</outputDirectory>
<includes>
<!-- this references your installer sub-project -->
<include>com.example:installer</include>
</includes>
<!-- must be unpacked inside the installer jar so it can be executed -->
<unpack>true</unpack>
<scope>runtime</scope>
</dependencySet>
<dependencySet>
<outputDirectory>/</outputDirectory>
<includes>
<!-- this references your server.war and any other dependencies -->
<include>com.example:server</include>
</includes>
<unpack>false</unpack>
<scope>runtime</scope>
</dependencySet>
</dependencySets>
</assembly>
Если вы сохранили описатель сборки как «installer.xml» вы можете построить свою флягу, запустив сборку, как это:
МВН чистый пакет сборки: одиночный -Ddescriptor = installer.xml
Надеюсь, что это помогает. Вот некоторые дополнительные ссылки, которые могут оказаться полезными: