Skip to content

Instantly share code, notes, and snippets.

@sjyun
Created May 7, 2014 06:33
Show Gist options
  • Save sjyun/62217adf6891abaca6af to your computer and use it in GitHub Desktop.
Save sjyun/62217adf6891abaca6af to your computer and use it in GitHub Desktop.
servlet3.0 build.gradle
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'eclipse'
apply plugin: 'eclipse-wtp'
apply plugin: 'jetty'
sourceCompatibility = 1.7
targetCompatibility = 1.7
compileJava.options.encoding = 'UTF-8'
buildDir = 'build'
repositories {
jcenter()
mavenCentral()
}
dependencies{
providedCompile 'javax.servlet:javax.servlet-api:3.1.0'
}
task initProject << {
createDir = {
it.mkdirs();
}
sourceSets.main.resources.srcDirs = ["src/main/resources"]
sourceSets*.java.srcDirs*.each createDir
sourceSets*.resources.srcDirs*.each createDir
createDir webAppDir
createDir new File(webAppDir, '/WEB-INF/views');
processResources {
from(sourceSets.main.resources.srcDirs) {
}
}
}
eclipse{
classpath {
downloadSources = true
downloadDoc = true
defaultOutputDir = file("${buildDir}/classes/main")
}
jdt{
sourceCompatibility = 1.7
targetCompatibility = 1.7
}
wtp{
component{
contextPath ='/'
}
facet{
facet name :'jst.web', version:'3.0'
facet name : 'jst.java', version:'1.7'
}
}
}
tasks.eclipse.dependsOn initProject
tasks.eclipse.dependsOn cleanEclipse
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment