I am using proguard with spring mvc and maven app.
My pom.xml build section looks like this:
<build> <finalName>myapp</finalName> <plugins> <plugin> <groupId>com.pyx4me</groupId> <artifactId>proguard-maven-plugin</artifactId> <executions> <execution> <phase>package</phase> <goals> <goal>proguard</goal> </goals> </execution> </executions> <configuration> <obfuscate>true</obfuscate> <injar>${project.build.finalName}</injar> <injar>${project.build.finalName}</injar> <inFilter>com.myapp.*</inFilter> </configuration> </plugin> </plugins>
I also tried:
<injar>${project.build.finalName}.war</injar>
When I run:
mvn clean install
Build Error Message:
[proguard] Reading program war [/Users/me/dev/git/myproject/myapp/target/myapp.war] (filtered) [proguard] Error: The input doesn't contain any classes. Did you specify the proper '-injars' options? ERROR] Failed to execute goal com.pyx4me:proguard-maven-plugin:2.0.4:proguard (default) on project myapp: Obfuscation failed (result=1) -> [Help 1]
It seems that I correctly selected my jar as messages before showing:
[INFO] --- proguard-maven-plugin:2.0.4:proguard (default) @ myapp --- [INFO] execute ProGuard [-injars, '/Users/me/dev/gitserver/myproject/myapp/target/myapp.war'(!META-INF/maven/**,com.myapp.*), -outjars, '/Users/me/dev/git/myproject/myapp/target/myapp_pg.war', -libraryjars, ....
Also, what options do you suggest using? This is spring mvc, so I have annotations like:
- @Autowired
- @Service
- @Repository
- @Controller
Therefore, any of these classes / fields should not be renamed, I would imagine.
(My goal is just to make a headache for someone who decompiles so that they cannot just decompile and use the code. Obfuscating will let them use it, but they wonβt be able to maintain the code base if they rewrite it. I donβt have any fantastic algorithms , so I have nothing to hide in this regard.)
Update
Let me clarify here, my spring mvc, using maven for some reason (I'm new to maven) when, when you run mvn clean install, it issues the file myapp.war and the exploded war myapp / (this is what I want to deploy in production, not myapp.war file)
In my myapp folder there is:
/target/myapp/ /target/myapp/meta-inf (empty folder) /target/myapp/web-inf /target/myapp/web-inf/classes (com.myapp. ...) /target/myapp/web-inf/lib/ /target/myapp/web-inf/ web.xml, application.xml (for spring) /target/myapp/web-inf/views/
So proguard should be confused in the folder / target / myapp / web -inf / classes? How can I say to do this?
Update 2
I get it now:
OK, I donβt get: the goal failed ... proguard .. Cannot rename / Users / me / dev / git / project1 / myapp / target / myapp / web-inf / classes (see my update section for what I changed in my pom.xml)
I changed my pom.xml with:
<configuration> <obfuscate>true</obfuscate> <injar>${project.build.finalName}/WEB-INF/classes/</injar> <inFilter>com/myapp/**</inFilter> </configuration>