java obfuscators with maven plugin support
I am looking for a java obfuscator with maven-plugin support? We tried using ProGuard but we ran into some runtime issues which doe开发者_如何学运维sn't happen if you don't obfuscate. Are there any alternate obfuscators.
Since ProGuard operates in a manner similar to most other Java obfuscators (at least the ones that I'm familiar with), it's pretty likely that you'll run into similar problems. (In fact, ProGuard goes out of its way to emit compliant bytecode, while some other obfuscators are rumored to be less vigilant about this.)
What sort of problems were you having? Typically the issues with using obfuscation are with name mangling - running into problems with other libraries being unable to locate public classes / methods / fields, or problems using reflection. This is often solveable by being very careful about which class names and method names you allow to be mangled.
The last time I used obfuscation on a Java project, we were fairly conservative about what was obfuscated. We placed the classes we wanted obfuscated into a subpackage of their original package called 'internal', and we obfuscated only .internal.. We found this much more usable than trying to determine what not to obfuscate.
Another issue with obfuscators is their optimization. Although I've not seen bugs from optimization in ProGuard, it's certainly not impossible. Regardless, I turn this off for a few reasons: first, when you get an (obfuscated) stack trace for a customer, it's hard enough to unmangle the names to determine what went wrong. If your obfuscator has optimized anything, that stack trace is likely meaningless. Second, it's unnecessary: the JVM is very, very good at optimizing byte code and this is interfering with that (thus potentially making it worse.)
Stringer Java Obfuscation Toolkit has a great set of options for integration with the IDE and build system, including Maven.
Several years ago, I had similar problem than you. If I remember correctly ProGuard did optimize short private method wrongly: It did dissmiss effects of "synchronized" keyworld of method during inlining.
We fix this problem by using -dontoptimize
option of ProGuard.
精彩评论