I am trying to make a complex build with Maven Shade and Proguard. The thing is that I only want to obfuscate my code and some related libraries (declared in the pom as dependencies), more libraries are present in the pom.xml
but I do not want to process them with Proguard.
My current approach is the following:
- Use
maven shade
to generate a Jar with the dependencies I want to obfuscate along with my code. (execution binded to package phase
) - Use Proguard to obfuscate the code. (
execution binded to package phase
) - Add the missing dependencies (Storm, etc) to the final Jar via a second execution of
maven shade
. (execution binded to verify phase
)
The thing is that in the third step (the second shade
), I get in the final Jar both obfuscated packages and unobfuscated ones.
Moreover, I also tried to rename via shade
the packages in the first step but the same happens, unobfuscated code along with the obfuscated renamed lives in the fat Jar.
Another thing that I tried is to exclude the unobfuscated packages in the second shade
but then I do not get any code from the previous steps, only the external libraries.
Any hints or different approaches to be considered?