有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java为什么gradle jettyRunWar任务不能与java8一起工作?

使用:Gradle2.0、SpringMVC4.0.6、Java8

我有下一个{}:

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) 个答案

  1. # 1 楼答案

    确保在Java8中使用asm5.0.1或更高版本

    仔细检查您的可传递依赖项,并确保覆盖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'
    }