Search code examples
javamavenproguardobfuscationsource-code-protection

Obfuscate Java source code to hand out to clients


I'm wondering if there is a way to generate an obfuscated buildable version of my maven project and hand it out to clients, the obfuscation is just for protection and make it hard to steal.

I'm using proGuard to obfuscate jars, but this obfuscation is at the ByteCode level, just like it was answered in this thread Obfuscate Java Source Code

If Obfuscation isn't possible, how can I hand out my source code and be sure that it won't be stolen (or just make it hard, by making poorly organised), although the client should be able to build and run the code.

EDIT : operations need to be performed :

1- remove all comments from source code.

2- merge all classes in one single package.

3- Have meaningless class names : (e.g. A, B, C ..)

4- remove all Unit tests.


Solution

  • The goal of obfuscation is to hide the source code, make the reverse engineering impossible. And proGuard works really well for that.

    What you want is to juridically protect your source code when you give it to your client. The best thing to do is to talk with a lawyer in order to have a legal form attached with the given code that your client will receive and sign, acknowledging that the code is yours and that he cannot not reuse it for different purposes as defined in the contract.