The spring-boot-maven-plugin has a goal that allows you to repackage an existing jar. This helped me in repackaging my obfuscated jar:
<plugin>
<groupId>com.github.wvengen</groupId>
<artifactId>proguard-maven-plugin</artifactId>
<version>2.0.14</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>proguard</goal>
</goals>
</execution>
</executions>
<configuration>
<proguardVersion>6.1.1</proguardVersion>
<obfuscate>true</obfuscate>
<injar>${project.build.finalName}.jar</injar>
<outjar>${project.build.finalName}.jar</outjar>
<outputDirectory>${project.build.directory}</outputDirectory>
<proguardInclude>${basedir}/config.pro</proguardInclude>
<libs>
<lib>${java.home}/lib/rt.jar</lib>
<lib>${java.home}/lib/jsse.jar</lib>
<lib>${java.home}/lib/jce.jar</lib>
</libs>
</configuration>
<dependencies>
<dependency>
<groupId>net.sf.proguard</groupId>
<artifactId>proguard-base</artifactId>
<version>6.1.1</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</plugin>
<!--Repackaging using the spring-boot-maven-plugin-->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
<configuration>
<excludes>
<exclude>
<groupId>com.afferentsoftware</groupId>
<artifactId>securemessageprocessor</artifactId>
</exclude>
<exclude>
<groupId>com.afferentsoftware</groupId>
<artifactId>messagelibmodule</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
However, I have recently migrated from Maven to Gradle (v5.4) and have been using the spring-boot-gradle-plugin:
plugin
{
id 'org.springframework.boot' version '2.1.8.RELEASE'
id 'io.spring.dependency-management' version '1.0.8.RELEASE'
}
I know that the bootJar task is now responsible to create the spring boot jar. However I have been unable use it to repackage my obfuscated jar.
How can I do that in Gradle with the Spring-boot-gradle-plugin?