5

I just tried the Shade plugin, but generated jar is always compressed.

How to turn off the jar compression ?

Here's the pom:

<build>
<plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>2.4</version>
        <configuration>
            <archive>
                <compress>false</compress>
            </archive>
        </configuration>
    </plugin>

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>1.7</version>
        <executions>
            <execution>
                <phase>package</phase>
                <goals>
                    <goal>shade</goal>
                </goals>
            </execution>
        </executions>
    </plugin>
</plugins>
</build>

Thanks

Fabrice

Tunaki
  • 132,869
  • 46
  • 340
  • 423
  • Why would you like to turn off the compression of a jar archive ? Can you elaborate a little bit more your intention? – khmarbaise Jun 20 '12 at 20:08
  • it's a "legacy" requirement. I'm migrating several projects from ant to maven, and I must ensure that produced artifacts are equals. Moreover, original "ant" artifacts (jar) where produced without compression, so I got to mimic that behavior – user1470083 Jun 20 '12 at 21:11
  • May be i misunderstand but what is jar without compression? Do you mean a simple folder with it's contents? You can check this simply by building and afterwards unpack via jar or unzip and compare the contents via diff. – khmarbaise Jun 21 '12 at 06:48
  • I mean "skip zip compression for the resulting jar file". Unfortunately, the shade plugin seems to be not "linked" to Maven Archiver, and therefore cannot be configured with "compress=false" – user1470083 Jun 21 '12 at 07:43

1 Answers1

4

Ok finally I managed to turn off jar compression, with help of Wayne's answer

and this link: http://maven.apache.org/plugins/maven-shade-plugin/examples/use-shader-other-impl.html