6

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

4

1 回答 1

8

使用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>
于 2012-07-11T04:17:00.723 回答