1.build.gradle
apply plugin:"war" apply plugin:"jetty" targetCompatibility = 1.7 version = "1.0" ext { springVersion = "3.2.8.RELEASE" } repositories{ mavenCentral() } [compileJava,compileTestJava,javadoc]*.options*.encoding = "UTF-8" dependencies{ compile "org.springframework:spring-webmvc:$springVersion" compile "com.fasterxml.jackson.core:jackson-databind:2.3.1" compile "commons-fileupload:commons-fileupload:1.3.1" providedCompile "javax.servlet:javax.servlet-api:3.1.0" providedCompile "javax.servlet.jsp:jsp-api:2.2.1-b03" providedCompile "javax.servlet.jsp.jstl:javax.servlet.jsp.jstl-api:1.2.1" compile "org.apache.taglibs:taglibs-standard-impl:1.2.1" testCompile "org.springframework:spring-test:$springVersion" testCompile "junit:junit:4.11" } jettyRun{ webAppSourceDirectory file("$projectDir/src/main/webapp") httpPort 8080 contextPath project.name scanIntervalSeconds 0 reload "automatic" }[compileJava,compileTestJava,javadoc]*.options*.encoding = "UTF-8"是为了解决包含中文的源码编译时出现乱码的问题.
源码:http://download.csdn.net/detail/xiejx618/7696799