POM文件
<build>
<finalName>${artifactId}</finalName>
<!-- <plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins> -->
<!-- <plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<testSource>${java.version}</testSource>
<testTarget>${java.version}</testTarget>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib</classpathPrefix>
<mainClass>cn.didisos.sos.cost.Demo30Application</mainClass>
</manifest>
</archive>
<excludes>
<exclude>*.xml</exclude>
<exclude>*.yml</exclude>
<exclude>*.properties</exclude>
</excludes>
</configuration>
</plugin>
</plugins> -->
<plugins>
<plugin>
<groupId>com.github.wvengen</groupId>
<artifactId>proguard-maven-plugin</artifactId>
<version>2.3.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>proguard</goal>
</goals>
</execution>
</executions>
<configuration>
<proguardVersion>6.2.2</proguardVersion>
<obfuscate>true</obfuscate>
<proguardInclude>${project.basedir}/src/main/resources/proguard.cfg</proguardInclude>
<libs>
<lib>${java.home}/lib/rt.jar</lib>
<lib>${java.home}/lib/jce.jar</lib>
</libs>
<injar>${project.build.finalName}.jar</injar>
<outjar>${project.build.finalName}.jar</outjar>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
<dependencies>
<dependency>
<groupId>net.sf.proguard</groupId>
<artifactId>proguard-base</artifactId>
<version>6.2.2</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass> cn.didisos.sos.cost.Demo30Application</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
proguard.cfg
-target 1.8
-dontshrink
-dontoptimize
#-ignorewarnings
#-dontskipnonpubliclibraryclasses
#-dontskipnonpubliclibraryclassmembers
-dontusemixedcaseclassnames
-allowaccessmodification
-adaptclassstrings
-keeppackagenames
-useuniqueclassmembernames
-keepattributes Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LineNumberTable,LocalVariable*Table,*Annotation,Synthetic,EnclosingMethod
-keep interface * extends * {*;}
-keepclassmembers class * {
@org.springframework.beans.factory.annotation.Autowired *;
@org.springframework.beans.factory.annotation.Value *;
@org.springframework.stereotype.Service *;
@org.springframework.stereotype.Component *;
@org.springframework.web.bind.annotation.PostMapping *;
@org.springframework.web.bind.annotation.DeleteMapping *;
@org.springframework.web.bind.annotation.RestController *;
@javax.annotation.Resource *;
}
-keep class * implements java.io.Serializable {*;}
-keep class * implements org.springframework.boot.CommandLineRunner {*;}
-keepclassmembers enum *{
*;
}
-keep class cn.didisos.sos.cost.Demo30Application{
public static void main(java.lang.String[]);
}
-keep class cn.didisos.sos.cost.Demo30Application{ *;}
-keep class cn.didisos.sos.cost.mapper.** {*;}
-keep class cn.didisos.sos.cost.model.** {*;}
-keepclassmembers public class * { void set*(***); *** get*();}
#-dontwarn **