17
Ноя
2017

Gradle com.bmuschko.tomcat plugin tomcatRun fails

После maven стал изучать gradle и столкнулся с проблемой, не получается сделать деплой проекта (gradle 4.3.1 , tomcat 8.5.15, IDEA ULTIMATE 2017.2).

На мавене проект деплоился в %tomcat-home%\webapps, все было просто.

С gradle как-то пока все сложнее, пробую делать по популярному плагину bmuschko-gradle-tomcat-plugin

gradle build - все ок

gradle tomcatRun - > Task :tomcatRun FAILED

гугл не решил вопрос, поэтому обращаюсь сюда.

В чем проблема, кто может показать как должно быть?

build.gradle

buildscript {
 repositories {
    jcenter()
    }

dependencies {
    classpath 'com.bmuschko:gradle-tomcat-plugin:2.4.1'
    }
}

apply plugin : 'java'
apply plugin : 'war'
apply plugin : 'com.bmuschko.tomcat'

compileJava.options.encoding = 'UTF-8'

tasks.withType(JavaCompile) {
    options.encoding = 'UTF-8'
}

repositories {
    mavenCentral()
}

dependencies {
    def tomcatVersion = '8.5.15'
    tomcat "org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}",
        "org.apache.tomcat.embed:tomcat-embed-logging-juli:8.5.2",
        "org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatVersion}"

    testImplementation 'junit:junit:4.12'
    providedCompile "javax.servlet:javax.servlet-api:3.1.0"
    testCompile group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3'
    testCompile group: 'org.mockito', name: 'mockito-all', version: '1.8.4'
}

tomcat {
    httpProtocol = 'org.apache.coyote.http11.Http11Nio2Protocol'
    ajpProtocol  = 'org.apache.coyote.ajp.AjpNio2Protocol'
}

консоль

 E:\DEV\Project\art-box>gradle build
 BUILD SUCCESSFUL in 1s
 5 actionable tasks: 5 up-to-date
 ...............................

 E:\DEV\Project\art-box>gradle tomcatRun
 .....
 > Task :tomcatRun FAILED
 Gradle now uses separate output directories for each JVM language, but this build assumes a single directory for all classes from a source set. This behaviour has been deprecated and is scheduled to be removed in Gradle 5.
 0
 Protocol handler instantiation failed
 java.lang.ClassNotFoundException: org.apache.coyote.http11.Http11Protocol
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)

 ..............................

 FAILURE: Build failed with an exception.

 * What went wrong:
 Execution failed for task ':tomcatRun'.
 > An error occurred starting the Tomcat server.

 * Try:
 Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

 * Get more help at https://help.gradle.org

 BUILD FAILED in 1s
 3 actionable tasks: 1 executed, 2 up-to-date

Источник: https://ru.stackoverflow.com/questions/746018/gradle-com-bmuschko-tomcat-plugin-tomcatrun-fails

Тебе может это понравится...

Добавить комментарий