也许有人可以帮助配置 gradle-tomcat-plugin?
这是build.gradle的内容:
buildscript {
ext {
springBootVersion = '1.1.9.RELEASE'
}
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath 'com.bmuschko:gradle-tomcat-plugin:2.0'
}
}
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'war'
apply plugin: 'spring-boot'
apply plugin: 'com.bmuschko.tomcat'
sourceCompatibility = 1.6
version = '1.0'
repositories {
mavenCentral()
jcenter()
}
dependencies {
def tomcatVersion = '7.0.42'
tomcat "org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}",
"org.apache.tomcat.embed:tomcat-embed-logging-juli:${tomcatVersion}"
tomcat("org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatVersion}") {
exclude group: 'org.eclipse.jdt.core.compiler', module: 'ecj'
}
}
运行任务 tomcatRun 时出现此错误:无法创建类型为 'TomcatRun' 的任务。这个缩影:
Caused by: java.lang.NoClassDefFoundError: org/codehaus/groovy/runtime/typehandling/ShortTypeHandling
at com.bmuschko.gradle.tomcat.tasks.Tomcat.<init>(Tomcat.groovy:28)
at com.bmuschko.gradle.tomcat.tasks.AbstractTomcatRun.<init>(AbstractTomcatRun.groovy)
at com.bmuschko.gradle.tomcat.tasks.TomcatRun.<init>(TomcatRun.groovy)
at com.bmuschko.gradle.tomcat.tasks.TomcatRun_Decorated.<init>(Unknown Source)
at org.gradle.api.internal.DependencyInjectingInstantiator.newInstance(DependencyInjectingInstantiator.java:62)
at org.gradle.api.internal.ClassGeneratorBackedInstantiator.newInstance(ClassGeneratorBackedInstantiator.java:36)
at org.gradle.api.internal.project.taskfactory.TaskFactory$1.call(TaskFactory.java:124)