I am trying to use Maven with the following configuration:
- Use the maven-assembly-plugin to create a single JAR with all the dependencies (build: single).
- Then use the Proguard plugin to trim all unnecessary classes from the included libraries.
I need proguard to reduce dependency size. The OpenIMAJ library that I use is huge (100 MB), and I only need a small subset of it.
The problem is that my current Maven configuration launches plugins in the opposite order - Proguard launches first and creates JARs without dependencies.
The plugin section of my pom.xml:
<plugins> <plugin> <groupId>com.github.wvengen</groupId> <artifactId>proguard-maven-plugin</artifactId> <version>2.0.6</version> <executions> <execution> <phase>package</phase> <goals><goal>proguard</goal></goals> </execution> </executions> <dependencies> <dependency> <groupId>net.sf.proguard</groupId> <artifactId>proguard-base</artifactId> <version>4.9</version> <scope>runtime</scope> </dependency> </dependencies> <configuration> <proguardVersion>4.9</proguardVersion> <options> <option>-verbose</option> <option>-dontobfuscate</option> <option>-dontoptimize</option> <option>-keep class org.apache.** { *; }</option> <option>-keep class no.** { *; }</option> </options> <libs> <lib>${java.home}/lib/rt.jar</lib> <lib>${java.home}/lib/jsse.jar</lib> </libs> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.0</version> <configuration> <source>1.7</source> <target>1.7</target> </configuration> </plugin> <plugin> <artifactId>maven-assembly-plugin</artifactId> <configuration> <archive> <manifest> <mainClass>fully.qualified.MainClass</mainClass> </manifest> </archive> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> </configuration> <executions> <execution> <id>make-assembly</id> <phase>package</phase> <goals> <goal>single</goal> </goals> </execution> </executions> </plugin> </plugins>
source share