I'm a little puzzled by proguard. I have this setting in my pom.xml Firstly, < injar > tag doesn't work...final call of proguard doesn't contain -injars if I use this tag. Secondly, I'm not sure if it's possible to obfuscate only one jar that takes place in WEB-INF/lib(I compile all my code in the one jar) and filter every other libs.
<plugin>
<groupId>com.pyx4me</groupId>
<artifactId>proguard-maven-plugin</artifactId>
<version>2.0.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>proguard</goal>
</goals>
</execution>
</executions>
<configuration>
<proguardVersion>4.8</proguardVersion>
<obfuscate>true</obfuscate>
<maxMemory>1024m</maxMemory>
<includeDependency>false</includeDependency>
<options>
<option>-injars target/Test.war</option>
<option>-ignorewarnings</option>
</options>
<outjar>target/Test-obf.war</outjar>
<attach>false</attach>
<outputDirectory>${project.build.directory}</outputDirectory>
<proguardInclude>${basedir}\proguard.conf</proguardInclude>
<libs>
<lib>${java.home}/lib/rt.jar</lib>
</libs>
<addMavenDescriptor>false</addMavenDescriptor>
<skip>false</skip>
</configuration>
<dependencies>
<dependency>
<groupId>net.sf.proguard</groupId>
<artifactId>proguard</artifactId>
<version>4.4</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</plugin>
With that configuration I have a lot of warnings cause it seems that proguard tries to obfuscate every jar in WEB-INF/lib Could someone spread the light on that. Thank you in advance.
Added: The problem with output that stands in front of all parameters was very tricky for me. As I understood you should not use ${basedir} when you specify both injars and outjars in pom.xml. Cause ${basedir} turns to absolute path and intenaly proguard also put an absolute path.
-libraryjars
option! – Nikolay Kuznetsov Dec 31 '12 at 6:13