You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a project now that is a springboot project. It contains 3 modules , module A depends on module B and module B depends on module C in a maven project . Now we want to obfuscate A module, B module, C module . Finally get a jar package and the code of the A、B、C、D module is obfuscated .
My steps:
Configuring proguard-maven-plugin in module A .
pom.xml as follows
<plugin>
<groupId>com.github.wvengen</groupId>
<artifactId>proguard-maven-plugin</artifactId>
<version>2.1.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>proguard</goal>
</goals>
</execution>
</executions>
<configuration>
<attach>true</attach>
<obfuscate>true</obfuscate>
<attachArtifactClassifier>pg</attachArtifactClassifier>
<options>
<option>-printmapping '${project.build.directory}/${project.artifactId}.log'</option>
<option>-ignorewarnings</option>
<option>-dontshrink</option>
<option>-dontoptimize</option>
<option>-dontskipnonpubliclibraryclasses</option>
<option>-dontskipnonpubliclibraryclassmembers</option>
<option>-allowaccessmodification</option>
<option>-useuniqueclassmembernames</option>
<option>-keeppackagenames</option>
<option>-adaptclassstrings</option>
<!-- <option>-keepdirectories</option> -->
<option>-keepattributes
Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LineNumberTable,LocalVariable*Table,*Annotation*,Synthetic,EnclosingMethod
</option>
<option>-keepnames interface **</option>
<!-- This option will save all original methods parameters in files defined in -keep sections, otherwise all parameter names will be obfuscate. -->
<option>-keepparameternames</option>
<option>-keepclassmembers class * {
@org.springframework.beans.factory.annotation.Autowired *;
@org.springframework.beans.factory.annotation.Value *;
@org.springframework.context.annotation.Bean *;
@org.springframework.beans.factory.annotation.Qualifier *;
@org.springframework.stereotype.Repository *;
@org.springframework.data.repository.NoRepositoryBean *;
}
</option>
<option>-keepclassmembers enum * { *; }</option>
<option>-keep class * implements java.io.Serializable</option>
<option>-keep class com.suny.demo.main.MainModuleApplication { *; }</option>
<option>-keepclassmembers public class * {void set*(***);*** get*();}
</option>
</options>
<outjar>${project.build.finalName}-pg.jar</outjar>
<libs>
<lib>${java.home}/lib/rt.jar</lib>
<lib>${java.home}/lib/jce.jar</lib>
</libs>
<injar>classes</injar>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</plugin>
B module and C module don't obfuscated plugin
Execute mvn package
Finally , The B and C module code is not obfuscated .
So , The result did not achieve my expected results .
I know this is a proGuard configuration file issue, not a bug . No similar configuration example in the documentation for my view of the plugin. So I want to ask if there is any suggestion for me. Thanks !
The text was updated successfully, but these errors were encountered:
If I understood correctly, you would like to have an example where defining this plugin in module A only would be able to obfuscate some of its dependencies at the same time.
Some options include:
having multiple executions in the Maven config, one for each module
using inclusions to include all the needed modules inside a single execution
forming a single uber jar with some other plugin (for example maven-shade-plugin) and then obfuscating this. In this option you need to be careful with the licenses of the dependencies, so make sure you are allowed to modify all the dependencies you would distribute in the end result.
I would happily merge any new examples for any of these options or I might even produce one myself, if you can provide an example project.
I have a project now that is a springboot project. It contains 3 modules , module A depends on module B and module B depends on module C in a maven project . Now we want to obfuscate A module, B module, C module . Finally get a jar package and the code of the A、B、C、D module is obfuscated .
My steps:
Configuring proguard-maven-plugin in module A .
pom.xml as follows
B module and C module don't obfuscated plugin
Execute
mvn package
Finally , The B and C module code is not obfuscated .
So , The result did not achieve my expected results .
I know this is a proGuard configuration file issue, not a bug . No similar configuration example in the documentation for my view of the plugin. So I want to ask if there is any suggestion for me. Thanks !
The text was updated successfully, but these errors were encountered: