Last active
December 19, 2015 09:29
-
-
Save dolmen/5932850 to your computer and use it in GitHub Desktop.
Running Proguard from Maven in the « package » goal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- 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