Last active
November 27, 2015 15:39
-
-
Save ogregoire/a5d11664a7b40e2693af to your computer and use it in GitHub Desktop.
proguard
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
<build> | |
<plugins> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-shade-plugin</artifactId> | |
<executions> | |
<execution> | |
<phase>package</phase> | |
<goals><goal>shade</goal></goals> | |
</execution> | |
</executions> | |
<configuration> | |
<artifactSet> | |
<includes> | |
<include>com.yourcompany.*:*</include> | |
</includes> | |
<!-- | |
maven-shade-plugin experiences issues shading dlls. | |
Unfortunately, our application has several. | |
You could also place some modules you don't want obfuscate. | |
--> | |
<excludes> | |
<exclude>com.yourcompany:native-library</exclude> | |
<exclude>com.yourcompany:another-native-library</exclude> | |
</excludes> | |
</artifactSet> | |
<transformers> | |
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> | |
<!-- This is entry point of your jar --> | |
<mainClass>com.yourcompany.Main</mainClass> | |
</transformer> | |
</transformers> | |
</configuration> | |
</plugin> | |
<plugin> | |
<groupId>com.github.wvengen</groupId> | |
<artifactId>proguard-maven-plugin</artifactId> | |
<executions> | |
<execution> | |
<phase>package</phase> | |
<goals><goal>proguard</goal></goals> | |
</execution> | |
</executions> | |
<configuration> | |
<!-- Our application is so big that ProGuard had ran out of memory --> | |
<maxMemory>1024m</maxMemory> | |
<!-- File with proguard configuration --> | |
<proguardInclude>${basedir}/proguard.conf</proguardInclude> | |
<!-- Now exclude all modules that are embedded in the jar, so that | |
ProGuard won't see redefinition of each single class. | |
You don't have to write down your main module. --> | |
<exclusions> | |
<exclusion> | |
<groupId>com.yourcompany</groupId> | |
<artifactId>data</artifactId> | |
</exclusion> | |
<!-- And so on --> | |
</exclusions> | |
<!-- | |
List external jars your application depends on | |
(that not listed in maven dependencies). | |
You probably depend on jave runtime (rt.jar). | |
JCE stands for Java Cryptography Extension. | |
You probably don't need it, but my application does. | |
--> | |
<libs> | |
<lib>${java.home}/lib/rt.jar</lib> | |
<lib>${java.home}/lib/jce.jar</lib> | |
<lib>${java.home}/lib/ext/sunjce_provider.jar</lib> | |
</libs> | |
</configuration> | |
</plugin> | |
</plugins> | |
</build> | |
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
-optimizationpasses 5 | |
-dontusemixedcaseclassnames | |
-dontskipnonpubliclibraryclasses | |
-dontpreverify | |
-verbose | |
-keep, allowobfuscation class be.ogregoire.* | |
-keepclassmembers, allowobfuscation class * { | |
*; | |
} | |
-keepnames class be.ogregoire.MyClass | |
-keepclassmembernames class be.ogregoire.MyClass { | |
public <methods>; | |
public <fields>; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment