2014-08-27 47 views
0

使用:搖籃2.0,Spring MVC的4.0.6,Java的8爲什麼gradle jettyRunWar任務不能用於java8?

我旁邊build.gradle

apply plugin: 'war' 
apply plugin: 'jetty' 
apply plugin: 'idea' 
apply plugin: 'java' 

sourceCompatibility = 1.8 
targetCompatibility = 1.8 

repositories { 
    mavenCentral() 
} 

dependencies { 
    providedCompile 'javax.servlet:servlet-api:2.5' 
    compile 'org.springframework:spring-webmvc:4.0.6.RELEASE' 
    runtime 'javax.servlet:jstl:1.1.2' 
} 

jettyRun.contextPath = '' 

jettyRunWar.contextPath = '' 

當我運行jettyRun應用程序工作正常。 但是當我運行jettyRunWar,我得到了一個錯誤:

org.springframework.core.NestedIOException: ASM ClassReader failed to parse class file - probably due to a new Java class file version that isn't supported yet 

是什麼任務,爲什麼第二次不工作之間的區別?

回答

1

確保您使用asm 5.0.1或更高版本的Java 8

仔細檢查您的傳遞依賴並確保覆蓋asm庫的使用是較新的版本。

這可能是你所需要的...

dependencies { 
    providedCompile 'javax.servlet:servlet-api:2.5' 
    compile 'org.springframework:spring-webmvc:4.0.6.RELEASE' 
    compile 'org.ow2.asm:asm:5.0.3' 
    runtime 'javax.servlet:jstl:1.1.2' 
} 
+0

謝謝! 「乾淨」任務完成後幫助了我。但是我仍然不明白爲什麼'jettyRunWar'在'jettyRun'工作時不工作。 – Lunigorn 2014-08-27 17:25:52

+0

錯誤來自spring使用'asm'庫。由於舊的'asm'庫無法正確解析Java 8字節碼,因此需要針對Java 8更新特定的組合。它根本不是Jetty的東西。 – 2014-08-27 17:42:31

相關問題