Proguard Ofustication 1
Proguard Ofustication 1
2. Add below plugins in service pom.xml (where the final jar of service build). Also add groupId
of service as comma separated in below spring plugin <excludeGroupIds> properties.
e.g if group id you the service is com.bootnext.visualyzer and add this group in plulgin property
like this <excludeGroupIds>com.bootnext.platform,com.bootnext.commons,
com.bootnext.visualyzer </excludeGroupIds>
<plugin>
<groupId>com.github.wvengen</groupId>
<artifactId>proguard-maven-plugin</artifactId>
<version>${proguard-maven-plugin.version}</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>proguard</goal>
</goals>
</execution>
</executions>
<configuration>
<silent>false</silent>
<injar>${project.build.finalName}.${project.packaging}</injar>
<proguardInclude>${proguard.conf}</proguardInclude>
<includeDependency>true</includeDependency>
<obfuscate>true</obfuscate>
<mappingFileName>${project.name}_map.txt</mappingFileName>
<assembly>
<inclusions>
<inclusion>
<groupId>com.bootnext.*</groupId>
<artifactId>*</artifactId>
</inclusion>
</inclusions>
</assembly>
<libs>
<lib>${java.home}/jmods/java.base.jmod</lib>
<lib>${java.home}/jmods/java.datatransfer.jmod</lib>
<lib>${java.home}/jmods/java.prefs.jmod</lib>
<lib>${java.home}/jmods/java.xml.jmod</lib>
<lib>${java.home}/jmods/java.desktop.jmod</lib>
</libs>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<outputDirectory>${output.dir}</outputDirectory>
<excludeGroupIds>com.bootnext.platform,com.bootnext.commons</excludeGroupIds>
<addResources>false</addResources>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<mainClass>com.bootnext.Application</mainClass>
</configuration>
</execution>
</executions>
</plugin>
With
java -jar -Xms$XMS -Xmx$XMX -XX:TieredStopAtLevel=1 -noverify -Xverify:none -XX:
+UseParallelGC -XX:MaxMetaspaceSize=1024m
-Dspring.config.location=file:./application.properties $JAR
Recommendation: Comment out copy dependency and maven jar plugin to skip lib folder
creation in final build. Spring plugin will create executable complete jar with all
dependencies.
Additional Info