Tuesday, August 13, 2013

Obfuscation with yGuard and Ant

Obfuscation is the action to create source code that is difficult for human to understand.
It is very important for enterprise java applications to protect project's source code easily viewed by others.

After trying ProGuard and yGuard, found that yGuard is pretty simple compare to ProGuard.

Below are the simplest steps to obfuscate a JAR with with yGuard.
1. download yGuard here.

2. extract and locate the yguard.jar at the same folder with Ant build.xml.

3. add the following target into the Ant build file.
<target depends="pakage-jar" name="yguard">
  <taskdef name="yguard" classname="com.yworks.yguard.YGuardTask"
    <inoutpair in="PROJECT_NAME.jar" out="PROJECT_NAME_OBJ.jar"/>
     <shrink />

change the PROJECT_NAME.jar that generated from the package-jar.
change the PROJECT_NAME_OBJ.jar to target destination.

4. more complicated example could refer yguard_ant_howto.html that comes with the yguard download.


No comments:

Post a Comment


Related Posts Plugin for WordPress, Blogger...