1

Maybe somebody can help to configure gradle-tomcat-plugin?

This is content of 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'
    }
}

While running task tomcatRun I get this error: Could not create task of type 'TomcatRun'. This stactrace:

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)
Robertas Setkus
  • 3,075
  • 6
  • 31
  • 54

2 Answers2

0

If anybody has the same problem probably you are using gradle not the gradle wrapper. I solved the problem by running gradlew tomcatRun task.

Robertas Setkus
  • 3,075
  • 6
  • 31
  • 54
0

You need to update Gradle to version 2.1 at least to make it work.

Mateusz Rasiński
  • 1,186
  • 1
  • 13
  • 15