Hi,
I am a beginner to Proguard and working on obfuscation .
my project is a maven Spring boot project but there are some steps which I needs to execute while obfuscating my code.
I can achieve that while using ant’s build.xml if we can write proguard steps in it .
I checked proguard documentation and got it that its possible with ant task
but we need to provide proguard.jar
I tried to download this jar through maven (as my project is maven )
and wrote my steps in it
but somehow its failing
the build.xml is
<?xml version="1.0" encoding="UTF-8"?> <!-- Creating temporary directory -->
<mkdir dir="obfuscate" />
<!-- Copy the files to that temporary directory to obfuscate-->
<copy todir="obfuscate/">
<fileset dir="target/edos-dp-geobox-bin/edos-dp-geobox/jars" includes="edos-dp-geobox-*.jar"/>
<!-- <fileset dir="target/edos-dp-geobox-bin/edos-dp-geobox" includes="*.xml" /> -->
</copy>
<!--create jar file for xml files to obfuscate -->
<jar destfile="obfuscate/config.jar" whenempty="fail">
<zipfileset dir="target/edos-dp-geobox-bin/edos-dp-geobox/" includes="*.xml"/>
</jar>
<!-- Delete our main files -->
<delete>
<fileset dir="target/edos-dp-geobox-bin/edos-dp-geobox/jars" includes="edos-dp-geobox-*.jar"/>
<fileset dir="target/edos-dp-geobox-bin/edos-dp-geobox" includes="*.xml" />
</delete>
<taskdef resource="proguard/ant/task.properties"
classpath="/target/edos-dp-geobox-bin/edos-dp-geobox/jars/proguard.jar" />
<!-- Copy the obfuscated jar files to main jarfiles -->
<copy todir="target/edos-dp-geobox-bin/edos-dp-geobox/jars/">
<fileset dir="obfuscate" />
<globmapper from="edos-dp-geobox-*_obf.jar" to="edos-dp-geobox-*.jar" />
</copy>
<!-- Copy the obfuscated xml files to main folder -->
<unzip dest="target/edos-dp-geobox-bin/edos-dp-geobox/" src="obfuscate/config_obf.jar">
<patternset includes="*.xml"/>
</unzip>
<!-- Delete temporary directory -->
<delete dir="obfuscate" />
<tar destfile="target/edos-dp-geobox-bin.tar" basedir="target/edos-dp-geobox-bin"/>
<gzip destfile="target/edos-dp-geobox-bin.tar.gz" src="target/edos-dp-geobox-bin.tar"/>
<delete>
<fileset dir="target/" includes="edos-dp-geobox-bin.tar"/>
</delete>