Obfuscating Several Jars in One Single Maven Build with ProGuard
ProGuard is nice and free tool for obfuscating your code. Actually, it can do a lot more: shrink, optimize and verify your application. But here we will stick solely on obfuscating several jars in one build with ProGuard and Maven.
There are some documentation on ProGuard Maven Plugin website, something on Stack Overflow and ofcourse in official documentation.
Say, you have a complex Java Web Start application consisting of several modules. And you want to obfuscate each module before release. Of course, you do not want to obfuscate for internal usage, but want to do it only before release. What you can do is to use Webstart Maven Plugin to assemble and sign the application. But before running it, you will obfuscate it with ProGuard Maven Plugin.
Now, the question is. How do you obfuscate several jars separately? The solution is pretty simple and based on old trick. You can have several different executions, but with different ids, each outputting obfuscate application to a different jar. For example:
...
<build>
...
<plugins>
<plugin>
<groupId>com.pyx4me</groupId>
<artifactId>proguard-maven-plugin</artifactId>
<version>2.0.4</version>
<executions>
<execution>
<id>first</id>
<phase>package</phase>
<goals>
<goal>proguard</goal>
</goals>
<configuration>
<outjar>first.jar</outjar>
<options>
<option>-keep public class dk.sorokin.maksim.first.Hello1 { public static void main(java.lang.String[]); }</option>
</options>
<assembly>
<inclusions>
<inclusion>
<groupId>dk.sorokin.maksim</groupId>
<artifactId>first</artifactId>
</inclusion>
</inclusions>
</assembly>
<libs>
<lib>${java.home}/lib/rt.jar</lib>
<lib>${java.home}/lib/javaws.jar</lib>
</libs>
</configuration>
</execution>
<execution>
<id>aaa</id>
<phase>package</phase>
<goals>
<goal>proguard</goal>
</goals>
<configuration>
<outjar>second.jar</outjar>
<options>
<option>-keep public class dk.sorokin.maksim.second.Hello2 { public String sayHello(); }</option>
</options>
<assembly>
<inclusions>
<inclusion>
<groupId>dk.sorokin.maksim</groupId>
<artifactId>second</artifactId>
</inclusion>
</inclusions>
</assembly>
<libs>
<lib>${java.home}/lib/rt.jar</lib>
<lib>${java.home}/lib/javaws.jar</lib>
</libs>
</configuration>
</execution>
</executions>
</plugin>
....
January 29th, 2012 - 03:07
you love this? cheapest bags with confident
January 29th, 2012 - 06:01
buy cheap fake designer handbags to your friends
January 29th, 2012 - 08:49
you definitely love cheap fendi for promotion code
January 29th, 2012 - 11:42
check cheap gucci bags with confident
January 30th, 2012 - 16:35
I’m sure the best for you cheap gucci wallet for less
January 30th, 2012 - 19:33
buy cheap louis vuitton online
January 30th, 2012 - 21:55
you will like cheap louis vuitton bags suprisely
January 31st, 2012 - 04:45
click to view cheap wholesale purses with confident