Integration of proguard and eclipse

Source: Internet
Author: User

If you are building j2se apps with eclipse and want to use proguard to compress, optimise or obfuscate your code you'll need to create an ant build. XML file to do this. I found various bits of help on the Internet explaining parts of the build. XML file, but couldn't find anywhere that gave the complete build. XML to do the full compile, jar and proguard steps.

Here is the full build. xml I cobbled together to do all three:
<?xml version="1.0" ?>

<project default="main">

<taskdef resource="proguard/ant/task.properties"
classpath="D:/apps/proguard4.0.1/lib/proguard.jar" />

<target name="main" depends="compile, jar, obfuscate"
description="Create project">
<echo>Creating project.</echo>
</target>

<target name="compile" description="Compile target">
<javac srcdir="src" destdir="bin"/>
</target>

<target name="jar" description="Jar target">
<jar jarfile="PhotoStamper_debug.jar"
basedir="bin" includes="*.class">
<manifest>
<attribute name="Main-Class" value="PhotoStamper" />
</manifest>
</jar>
</target>

<target name="obfuscate" depends="jar"
description="Obfuscate compiled classes">
<proguard>
-libraryjars "${java.home}/lib/rt.jar"
-injars PhotoStamper_debug.jar
-outjars PhotoStamper.jar
-keep public class PhotoStamper {
public static void main(java.lang.String[]);
}
</proguard>
</target>

</project>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.