Я использую сборку maven assembly-plugin, и я хочу создать ZIP-файл, который среди других файлов содержит толстую банку (jar- с-зависимостей). Я не могу создать это за один проход, используя mvn package
. Я могу либо раскомментировать конфигурацию для descriptor
, либо раскомментировать часть jar-with-dependencies
.Использование плагина сборки maven для создания ZIP-файла, содержащего толстую банку (jar-with-dependencies)
build
часть pom.xml
выглядит следующим образом:
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>src/main/assembly/dist.xml</descriptor>
</descriptors>
<finalName>sample-documentum-downloader</finalName>
</configuration>
<executions>
<execution>
<id>jar-with-dependencies</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>${project.artifactId}</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.foo.DownloadDocuments</mainClass>
</manifest>
</archive>
</configuration>
</execution>
<execution>
<id>assemble-all</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
и dist.xml
является:
<assembly>
<id>dist</id>
<formats>
<format>zip</format>
</formats>
<files>
<file>
<source>target/${project.artifactId}.jar</source>
<outputDirectory>/</outputDirectory>
</file>
<file>
<source>data/input/docId.txt</source>
<outputDirectory>data/input/</outputDirectory>
</file>
<file>
<source>data/export/exported_files_will_be_created_here.txt</source>
<outputDirectory>data/export/</outputDirectory>
</file>
<file>
<source>src/main/resources/dfc.properties</source>
<outputDirectory>/</outputDirectory>
</file>
<file>
<source>src/main/resources/dfc.keystore</source>
<outputDirectory>/</outputDirectory>
</file>
</files>
<fileSets>
<fileSet>
<directory>${project.basedir}</directory>
<includes>
<include>*.cmd</include>
<include>README.pdf</include>
</includes>
<useDefaultExcludes>true</useDefaultExcludes>
</fileSet>
</fileSets>
Как я могу перестроить, чтобы создать ZIP, включая дальний JAR в один забег.
Спасибо за вашу поддержку.