Question

Is there an option in Maven (2.0.9) to turn off jar compression for the entire operation? I'm using Maven both in the build server and in my work station and I'd like to disable jar compression on the work station builds (development only). However, I don't want to touch all the poms and create two versions for each.

Is there an option for turning off jar compression by environment variable, file or by touching a single pom.xml?

Was it helpful?

Solution

Well, you could define different jar plugin by profile. Would that be acceptable?

OTHER TIPS

Apparently it's possible by defining this:

 <profile><id>...</id>
   <build>
     <pluginManagement>
         <plugins>
             <plugin>
                 <configuration>
                     <archive>
                         <compress>false</compress>
                    </archive>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
  </build>
</profile>

in the top-level pom.xml. As a side note - this didn't really solved my initial problem of the build taking too much time.

Add the following to the build.plugins section in your project's pom.xml file.

<plugin>
    <artifactId>maven-jar-plugin</artifactId>
    <version>2.2</version>
    <configuration>
        <archive>
            <compress>false</compress>
        </archive>
    </configuration>
</plugin>

This turns off jar file compression for your maven project.

finally I found the answer of this topic (turn off the jar compression), configuring directly into the pom, also I found other two interesting details: putting a different jar's name and includ a "manifest" definition. Here is my pom fragment.

<build>
    <finalName>***FileName***</finalName>

    <plugins>

        <!-- Set a JDK compiler level -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>${jdk.version}</source>
                <target>${jdk.version}</target>
            </configuration>
        </plugin>

        <!-- Make this jar executable -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <configuration>
              <archive>
                <manifest>
                    <!-- Jar file entry point -->
                    <mainClass>***package.test.ClassTest***</mainClass>
                </manifest>
                <compress>***false***</compress>
              </archive>
            </configuration>
        </plugin>

    </plugins>
</build>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top