Manfred, this was a huge help - thanks! I totally missed the part in
the ProGuard docs that says you can specify a directory name in the
<injar> parameter...
I seem to have ProGuard running, although the most recent version
(4.6) isn't in the Maven repos so I had to specify a dependency on
release 4.4 until I can get 4.6 into my local repo. I've included my
final plugin definition below - note that this is for Mac OS X 10.5 so
I needed to specify a different JVM runtime JAR that the "rt.jar" seen
in the proguard-maven-plugin examples.
<plugin>
<groupId>com.pyx4me</groupId>
<artifactId>proguard-maven-plugin</artifactId>
<version>2.0.4</version>
<executions>
<execution>
<phase>process-classes</phase>
<goals><goal>proguard</goal></goals>
</execution>
</executions>
<configuration>
<proguardVersion>4.4</proguardVersion>
<obfuscate>true</obfuscate>
<injar>classes</injar>
<proguardInclude>${basedir}/src/main/resources/build/
proguard/plugins-convert-latin1.pro</proguardInclude>
<libs>
<lib>/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/
Contents/Classes/classes.jar</lib>
</libs>
</configuration>
<dependencies>
<dependency>
<groupId>net.sf.proguard</groupId>
<artifactId>proguard</artifactId>
<version>4.4</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</plugin>
Cheers
Chris
On Mar 30, 2011, at 4:12 PM, Manfred Moser wrote:
I'm a new user of Maven. I have a POM that is creating a signed jar
using Maven 3.0.2 and maven-jar-plugin - that part seems to be
working
well, but now I want to integrate ProGuard in order to obfuscate the
code before signing the JAR. Ideally I'd like to obfuscate the code
before the Maven test phase so that tests will run on the obfuscated
code, but the ProGuard docs seem to imply that I can only obfuscate
the code after it's been packaged into a JAR. Has anybody run
ProGuard on the pre-test-phase compiled classes, and if so how did
you
set up your POM and ProGuard configuration?
If it's true that I can only obfuscate a JAR then I'm not clear on
how
I would insert a ProGuard goal in between the point at which the JAR
to be signed is created and the actual signing process - the docs for
the proguard-maven-plugin aren't quite clear on how that's done.
Do I
need to split the process into a jar creation step using the maven-
jar-
plugin, a ProGuard step and then a signing step using the maven-
jarsigner-plugin? and if so, how can I set this up so that the goals
run in this order within the package phase without explicitly
specifying them on the command line?
In the android world this is exactly what you need to do too.. and I
wrote
some blog posts that explain the details and link to a fully working
example implementation.
http://www.simpligility.com/2010/12/proguard-for-android-with-maven-without-shooting-yourself-in-the-foot/
http://www.simpligility.com/2010/12/hints-for-using-proguard-on-your-android-app/
That should explain it all.
manfred
http://simpligility.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]