Before getting into the technical details, let's create an extremely simple hello world servlet. To do it, we will set up a Gradle project with the build file, build.gradle, the servlet class in the src/main/java/packt/java9/by/example/mastermind/servlet/HelloWorld.java file, and, last but not least, we have to create the file src/main/webapp/WEB-INF/web.xml. The gradle.build file will look like the following:
apply plugin: 'java' apply plugin: 'war' apply from: 'https://raw.github.com/gretty-gradle-plugin/gretty/master/pluginScripts/gretty.plugin' repositories { jcenter() } targetCompatibility = "1.10" sourceCompatibility = "1.10" dependencies { providedCompile "javax.servlet:javax.servlet-api:3.1.0" testCompile 'junit:junit:4.12' ...