views:

154

answers:

2

I need to send part of our code for one of our tool vendors, and I want to remove all references to our project from our classes.

There are dozens of obfuscators available for java, but I don't want to scramble the code, just do as simple and consistent as possible renaming. (Maybe this is configurable in some of the obfuscators?) Best option would be to have something like classes A, B, C, methods a1, a2, a3...

It would also be great if the tool was somehow integrated with Eclipse's refactor/rename option, but this is not necessary.

+4  A: 

ProGuard can be used to obfuscate using a predefined mapping with the -applymapping filename option. In combination with the -dontshrink and -dontoptimize options it may do what you want. I am not awair of a general eclipse plugin, but if you are building with ant, there is an task included in the distribution.

Reuben Peeris
Thanks, I'll have to take a look at that. We are using maven so a maven plugin would be nice.
tputkonen
There is a maven plugin available for proguard we currently use it. http://pyx4me.com/pyx4me-maven-plugins/proguard-maven-plugin/
PintSizedCat
A: 

What's wrong with Eclipse's renaming facility? Sounds like you have to be selective about your renaming, so this might be just as fast as creating some kind of mapping file.

Flo
It'd be prone to messiness and takes a long time.
PintSizedCat
Well, guess it depends on the amount of code to be shipped out. He stated it was "part of [the] code" so might as well be a rather small amount of classes to be renamed. Sure, wouldn't want to do manual renaming for several dozen classes.
Flo
We have tens of classes and the number of methods and fields is in the hundreds.
tputkonen