2016-06-22 91 views
3

我的.jar與彈簧引導加載器運行內部嵌套項:無法打開的.jar

apply plugin: 'spring-boot' 

jar { 
    into('lib') { 
     from configurations.runtime 
    } 
    manifest { 
     attributes("Implementation-Vendor": "tttt", 
      "Implementation-Title": project.name, 
      "Implementation-Version": version, 
      "Implementation-Vendor-Id": "tttt", 
      "Built-By": "Administrator", 
      "Build-Jdk": "1.7.0_101", 
      "Start-Class": "org.cp.Application", 
      "Spring-Boot-Version": "1.3.3.RELEASE", 
      "Main-Class": "org.springframework.boot.loader.JarLauncher") 
    } 
} 

我跑我的體型:

:ttt:compileJava 
:ttt:processResources 
:ttt:classes 
:ttt:findMainClass 
:ttt:jar 
:ttt:bootRepackage 
:ttt:assemble 
:ttt:check 
:ttt:build 

Java的罐子tttt.jar:

java.lang.IllegalStateException: Unable to open nested entry 'lib/spring-boot-starter-1.3.3.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:382) 
at org.springframework.boot.loader.jar.JarFile.createJarFileFromEntry(JarFile.java:357) 
at org.springframework.boot.loader.jar.JarFile.getNestedJarFile(JarFile.java:343) 
at org.springframework.boot.loader.archive.JarFileArchive.getNestedArchive(JarFileArchive.java:112) 
at org.springframework.boot.loader.archive.JarFileArchive.getNestedArchives(JarFileArchive.java:96) 
at org.springframework.boot.loader.ExecutableArchiveLauncher.getClassPathArchives(ExecutableArchiveLauncher.java:75) 
at org.springframework.boot.loader.Launcher.launch(Launcher.java:60) 
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52) 

我將spring.boot.loader手動分解到src/main/resources中,如果這意味着什麼的話。我在這裏做錯了什麼?

回答

0

您無法在JAR中執行Jar。如果您需要這樣做,那麼您必須將相關的JAR添加到環境變量&中以利用它。

+0

我不知道我是否正確地問了我的問題,但使用Maven構建時此工作正常,但不適用於Gradle。 – minas