After maven began to study gradle and ran into a problem, it is impossible to make a project deployment (gradle 4.3.1, tomcat 8.5.15, IDEA ULTIMATE 2017.2).
On the maven, the project was deployed to %tomcat-home%\webapps , everything was simple.
With gradle it is somehow harder somehow, I try to do it using the popular plugin bmuschko-gradle-tomcat-plugin
gradle build - everything is ok
gradle tomcatRun -> Task: tomcatRun FAILED
Google did not solve the question, so I appeal here.
What is the problem, who can show how it should be?
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' } console
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