代码拉取完成,页面将自动刷新
group = 'com.hh'
version = "1.0.1.SNAPSHOT"
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'war'
apply plugin: 'eclipse'
apply plugin: 'eclipse-wtp'
apply plugin: 'jetty'
apply plugin: 'maven'
// Fills out all dependencies which are necessary to start the embedded jetty into our war file
configurations {
embeddedJetty
}
dependencies {
compile 'org.springframework:spring-webmvc:4.1.1.RELEASE'
compile 'org.springframework:spring-context-support:4.1.1.RELEASE'
compile 'commons-io:commons-io:2.4'
compile 'org.apache.commons:commons-lang3:3.3.2'
compile 'commons-beanutils:commons-beanutils:1.9.2'
compile 'com.google.guava:guava:18.0'
compile 'commons-validator:commons-validator:1.4.0'
// mongo
compile 'org.mongodb:mongo-java-driver:2.12.1'
compile 'com.github.jmkgreen.morphia:morphia:1.2.3'
compile 'com.github.jmkgreen.morphia:morphia-validation:1.2.3'
compile 'org.hibernate:hibernate-validator-annotation-processor:4.1.0.Final'
compile 'joda-time:joda-time:2.4'
// log
compile 'org.slf4j:slf4j-log4j12:1.7.7'
//providedCompile 'org.eclipse.jetty:jetty-webapp:9.2.3.v20140905'
providedCompile 'servletapi:servlet-api:2.4'
testCompile 'junit:junit:4.11'
// jetty
embeddedJetty 'org.eclipse.jetty:jetty-servlet:9.2.3.v20140905'
embeddedJetty 'org.eclipse.jetty:jetty-webapp:9.2.3.v20140905'
embeddedJetty 'org.eclipse.jetty:jetty-server:9.2.3.v20140905'
embeddedJetty 'org.eclipse.jetty:jetty-jsp:9.2.3.v20140905'
//embeddedJetty 'org.eclipse.jetty:jetty-annotations:9.2.3.v20140905'
}
repositories {
maven { url "http://maven.oschina.net/content/groups/public" }
mavenCentral()
}
//////////////jetty start////////////////
//war.baseName = 'MyExecutableWar'
war {
// unzip and add all jetty dependencies into the root of our war file
from {configurations.embeddedJetty.collect {
project.zipTree(it)
}
}
// remove signature and unnecessary files
exclude "META-INF/*.SF", "META-INF/*.RSA", "about.html", "about_files/**", "readme.txt", "plugin.properties", "jetty-dir.css"
// include in the root of the war only the classes which will be used to start the embedded Jetty
from ("$buildDir/classes/main/com/hh/us/jetty") {
into "com/hh/us/jetty"
}
//exclude "com/myapp/"
// sets the main class to run when the generate war be executed using 'java -jar'
manifest {
attributes (
'Main-Class': 'com.hh.us.jetty.JettyStarter',
"Implementation-Title": project.name,
"Implementation-Version": project.version,
"Built-JDK": System.getProperty('java.version'),
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
)
}
}
// Once you will need some basic api (servlet api, for example) for compilation, you need to add embeddedJetty dependencies for compilation
sourceSets.main.compileClasspath += configurations.embeddedJetty
// you need to do the same for eclipse classpath, so you can use it to edit your java files
eclipse {
classpath {
plusConfigurations += [configurations.embeddedJetty]
downloadSources=true
}
}
//////////////jetty end////////////////
tasks.withType(JavaCompile) {
sourceCompatibility = 1.7
targetCompatibility = 1.7
}
task wrapper(type: Wrapper) { gradleVersion = '2.2.1' }
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。