Skip to content

Instantly share code, notes, and snippets.

@d0nkeyBOB
Forked from dolmen/pom-proguard.xml
Created November 8, 2013 19:41
Show Gist options
  • Save d0nkeyBOB/7376465 to your computer and use it in GitHub Desktop.
Save d0nkeyBOB/7376465 to your computer and use it in GitHub Desktop.
<!-- Proguard, via une tâche Ant, pour être indépendant des plugins d'intégration
pour Maven car aucun d'eux n'est officiel et correctement maintenu -->
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<configuration>
<proguardVersion>4.9</proguardVersion>
</configuration>
<dependencies>
<dependency>
<groupId>net.sf.proguard</groupId>
<artifactId>proguard-anttask</artifactId>
<version>4.9</version>
</dependency>
</dependencies>
<executions>
<execution>
<phase>package</phase>
<configuration>
<target>
<property name="pg.injar" value="${project.build.directory}/${project.build.finalName}.orig.jar"/>
<property name="pg.outjar" value="${project.build.directory}/${project.build.finalName}.jar"/>
<property name="pg.map" value="${project.build.directory}/${project.build.finalName}.map"/>
<delete>
<fileset file="${pg.injar}"/>
<fileset file="${pg.map}"/>
</delete>
<!-- Renomme l'artifact original pour que le résultat de Proguard porte ce nom -->
<move file="${pg.outjar}" tofile="${pg.injar}" overwrite="false" />
<echoproperties regex="^(?:pg|project|maven\.dependency)\."/>
<!-- Doc: http://proguard.sourceforge.net/#manual/ant.html -->
<taskdef resource="proguard/ant/task.properties" classpathref="maven.plugin.classpath"/>
<proguard><![CDATA[
-injars <pg.injar>
-outjars <pg.outjar>
-libraryjars <java.home>/lib/rt.jar(java/lang/**,java/io/*,java/net/*,java/util/*,java/nio/**)
-libraryjars <maven.dependency.xxx.jar.path>
...
-printseeds
-printmapping <pg.map>
-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable
...
]]></proguard>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment