Create a gist now

Instantly share code, notes, and snippets.

maven configuration to shrink war package. this is specially useful when using appengine with spring, because you need to reduce classpath scanning and package size as much as possible to reduce cold startup times.
<plugin>
<dependencies>
<dependency>
<groupId>net.sf.proguard</groupId>
<artifactId>proguard-base</artifactId>
<version>4.8</version>
</dependency>
</dependencies>
<groupId>com.github.wvengen</groupId>
<artifactId>proguard-maven-plugin</artifactId>
<!-- TODO: need to remove this.. -->
<executions>
<execution>
<id>process-classes-with-proguard</id>
<phase>package</phase>
<goals>
<goal>proguard</goal>
</goals>
</execution>
</executions>
<configuration>
<options>
<option>-dontoptimize</option>
</options>
<obfuscate>false</obfuscate>
<attach>false</attach>
<skip>true</skip>
<addMavenDescriptor>false</addMavenDescriptor>
<maxMemory>1024m</maxMemory>
<libs>
<lib>${java.home}/lib/rt.jar</lib>
<lib>${java.home}/lib/jsse.jar</lib>
</libs>
<proguardVersion>4.8</proguardVersion>
<injar>${project.build.finalName}/WEB-INF/lib/${project.build.finalName}.jar</injar>
<outjar>proguard</outjar>
<!-- <injar>${project.build.directory}/${project.build.finalName}-jar-with-dependencies.jar</injar> -->
<attachArtifactType>jar</attachArtifactType>
<proguardInclude>${project.basedir}/proguard.conf</proguardInclude>
<includeDependency>true</includeDependency>
<assembly>
<inclusions>
<inclusion>
<groupId>com.allthecooks</groupId>
<artifactId>allthecooks-conversion</artifactId>
</inclusion>
<inclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</inclusion>
<inclusion>
<groupId>com.google.appengine.tools</groupId>
<artifactId>appengine-mapreduce</artifactId>
</inclusion>
<inclusion>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-endpoints</artifactId>
</inclusion>
<inclusion>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-jsr107cache</artifactId>
</inclusion>
<inclusion>
<groupId>net.sf.jsr107cache</groupId>
<artifactId>jsr107cache</artifactId>
</inclusion>
<inclusion>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jpa_2.0_spec</artifactId>
</inclusion>
<inclusion>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-core</artifactId>
<filter>!org/apache/lucene/util/RamUsageEstimator*</filter>
</inclusion>
<inclusion>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-highlighter</artifactId>
</inclusion>
<inclusion>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-facet</artifactId>
</inclusion>
<inclusion>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-memory</artifactId>
</inclusion>
<inclusion>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-spellchecker</artifactId>
</inclusion>
<inclusion>
<groupId>com.restfb</groupId>
<artifactId>restfb</artifactId>
</inclusion>
<inclusion>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client-appengine</artifactId>
</inclusion>
<inclusion>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client-servlet</artifactId>
</inclusion>
<inclusion>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client</artifactId>
</inclusion>
<inclusion>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client-gson</artifactId>
</inclusion>
<inclusion>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-plus</artifactId>
</inclusion>
<inclusion>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-oauth2</artifactId>
</inclusion>
<inclusion>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</inclusion>
<inclusion>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-enhancer</artifactId>
</inclusion>
<inclusion>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-jdo-query</artifactId>
</inclusion>
<inclusion>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
</inclusion>
<inclusion>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</inclusion>
<inclusion>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</inclusion>
<inclusion>
<groupId>org.beanshell</groupId>
<artifactId>bsh</artifactId>
</inclusion>
<inclusion>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
</inclusion>
<inclusion>
<groupId>org.reflections</groupId>
<artifactId>reflections-spring</artifactId>
</inclusion>
<inclusion>
<groupId>com.googlecode.java-diff-utils</groupId>
<artifactId>diffutils</artifactId>
</inclusion>
<inclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</inclusion>
<inclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<filter>!org/springframework/web/servlet/support/JstlUtils*</filter>
</inclusion>
<inclusion>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
</inclusion>
<inclusion>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-tools</artifactId>
</inclusion>
<inclusion>
<groupId>com.googlecode.htmlcompressor</groupId>
<artifactId>htmlcompressor</artifactId>
</inclusion>
<inclusion>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
</inclusion>
<inclusion>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
</inclusion>
<inclusion>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
</inclusion>
<inclusion>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
</inclusion>
<inclusion>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
</inclusion>
<inclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</inclusion>
<inclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</inclusion>
<inclusion>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
</inclusion>
<inclusion>
<groupId>com.yahoo.platform.yui</groupId>
<artifactId>yuicompressor</artifactId>
</inclusion>
<inclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-asm</artifactId>
</inclusion>
<inclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
</inclusion>
<inclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
</inclusion>
<inclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</inclusion>
<inclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</inclusion>
<inclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</inclusion>
<inclusion>
<groupId>aopalliance</groupId>
<artifactId>aopalliance</artifactId>
</inclusion>
<inclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</inclusion>
<inclusion>
<groupId>commons-digester</groupId>
<artifactId>commons-digester</artifactId>
</inclusion>
<inclusion>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
</inclusion>
<inclusion>
<groupId>sslext</groupId>
<artifactId>sslext</artifactId>
</inclusion>
<inclusion>
<groupId>oro</groupId>
<artifactId>oro</artifactId>
</inclusion>
<inclusion>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
</inclusion>
<inclusion>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</inclusion>
<inclusion>
<groupId>commons-chain</groupId>
<artifactId>commons-chain</artifactId>
</inclusion>
<inclusion>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
</inclusion>
<inclusion>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</inclusion>
<inclusion>
<groupId>javax.transaction</groupId>
<artifactId>transaction-api</artifactId>
</inclusion>
<inclusion>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</inclusion>
<inclusion>
<groupId>rhino</groupId>
<artifactId>js</artifactId>
</inclusion>
<inclusion>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
</inclusion>
<inclusion>
<groupId>xpp3</groupId>
<artifactId>xpp3</artifactId>
</inclusion>
<inclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</inclusion>
<inclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
</inclusion>
</inclusions>
</assembly>
</configuration>
</plugin>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment