Я использовал ProGuard для моего проекта весенней загрузки.После выполнения ProGuard мой исполняемый проект не работает.Вы можете увидеть исключение ниже
Исключение:
Exception in thread "main" java.lang.IllegalStateException: Failed to get nested archive for entry BOOT-INF/lib/spring-boot-starter-data-rest-2.0.5.RELEASE.jar
at org.springframework.boot.loader.archive.JarFileArchive.getNestedArchive(JarFileArchive.java:108)
at org.springframework.boot.loader.archive.JarFileArchive.getNestedArchives(JarFileArchive.java:86)
at org.springframework.boot.loader.ExecutableArchiveLauncher.getClassPathArchives(ExecutableArchiveLauncher.java:70)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:49)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
Caused by: java.io.IOException: Unable to open nested jar file 'BOOT-INF/lib/spring-boot-starter-data-rest-2.0.5.RELEASE.jar'
at org.springframework.boot.loader.jar.JarFile.getNestedJarFile(JarFile.java:254)
at org.springframework.boot.loader.jar.JarFile.getNestedJarFile(JarFile.java:239)
at org.springframework.boot.loader.archive.JarFileArchive.getNestedArchive(JarFileArchive.java:103)
... 4 more
Caused by: java.lang.IllegalStateException: Unable to open nested entry 'BOOT-INF/lib/spring-boot-starter-data-rest-2.0.5.RELEASE.jar'. It has been compressed and nested jar files must be stored without compression. Please check the mechanism used to create your executable jar file
at org.springframework.boot.loader.jar.JarFile.createJarFileFromFileEntry(JarFile.java:282)
at org.springframework.boot.loader.jar.JarFile.createJarFileFromEntry(JarFile.java:262)
at org.springframework.boot.loader.jar.JarFile.getNestedJarFile(JarFile.java:250)
... 6 more
Мой файл pom.xml:
<plugin>
<groupId>com.github.wvengen</groupId>
<artifactId>proguard-maven-plugin</artifactId>
<version>2.0.8</version>
<configuration>
<obfuscate>false</obfuscate>
<exclusions>
<exclusion>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jersey</artifactId>
</exclusion>
<exclusion>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</exclusion>
<exclusion>
<groupId>org.glassfish.hk2.external</groupId>
<artifactId>asm-all-repackaged</artifactId>
</exclusion>
</exclusions>
<options>
<option>-dontnote</option>
<option>-ignorewarnings</option>
<option>-dontwarn</option>
<option>-dontshrink</option>
<option>-dontoptimize</option>
<option>-dontpreverify</option>
<option>-keepparameternames</option>
<option>-keepdirectories **</option>
<option>-dontskipnonpubliclibraryclasses</option>
<option>-dontskipnonpubliclibraryclassmembers</option>
<option>-keep class CitysurfsqlapiApplication</option>
<option>-keepclasseswithmembers class com.citysurf.citysurfsqlapi.*</option>
<option>-keep class org.springframework.boot.loader.JarLauncher {public static void main(java.lang.String[]);}</option>
<option>-keep public class * { public protected *;}</option>
<option>-adaptresourcefilecontents **.properties,META-INF/MANIFEST.MF,META-INF/spring.*</option>
<option>-printmapping '${project.build.directory}/${project.artifactId}.log'</option>
<option>-keep class * extends *</option>
<option>-keep interface * extends *</option>
<option>-keep public class org.springframework.**</option>
<option>-keep public class * { public private *; }</option>
<option>-keepattributes Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LineNumberTable,*Annotation*,EnclosingMethod,LocalVariable*Table</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>-useuniqueclassmembernames</option>
<option>-keepattributes *Annotation*</option>
<option>-keep public class org.springframework.**</option>
<option>-keep class * { *; }</option>
<option>-keepdirectories</option>
<option>-allowaccessmodification</option>
</options>
<libs>
<lib>${java.home}/lib/rt.jar</lib>
<lib>${java.home}/lib/jce.jar</lib>
</libs>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>proguard</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>net.sf.proguard</groupId>
<artifactId>proguard-base</artifactId>
<version>5.2</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</plugin>