如何使用maven-assembly-plugin构建ZIP存档时禁用压缩

tru*_*tin 4 maven maven-assembly-plugin

我有一个由maven-assembly-plugin生成的ZIP存档.它主要包含已经压缩的JAR.再次压缩它们只会增加构建时间而不会有任何好处.在构建ZIP存档时,如何配置maven-assembly-plugin(或程序集描述符)来关闭压缩(即仅存储)?

pru*_*nge 6

使用archiverConfig程序集插件配置中的元素,将compress选项设置为false.

例如

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-assembly-plugin</artifactId>
    <version>2.3</version>
    <configuration>
        <descriptors>
            <descriptor>src/main/assembly/zip-application.xml</descriptor>
        </descriptors>
        <attach>true</attach>

        <!-- Turn off compression -->
        <archiverConfig>
            <compress>false</compress>
        </archiverConfig>
    </configuration>
    <executions>
        <execution>
            <id>create-zip</id>
            <phase>package</phase>
            <goals>
                <goal>single</goal>
            </goals>
        </execution>
    </executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)