-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle
89 lines (78 loc) · 2.59 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
apply plugin: 'groovy'
apply plugin: 'war'
apply plugin: 'jetty'
apply plugin: 'tomcat'
//defaultTasks 'test', 'war'
defaultTasks 'classes'
// See: https://github.com/bmuschko/gradle-tomcat-plugin
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath 'org.gradle.api.plugins:gradle-tomcat-plugin:0.9.7'
}
}
repositories {
mavenLocal()
mavenCentral()
}
/* See:
* http://gradle.1045684.n5.nabble.com/Groovy-Java-mixed-codebase-td1435484.html
* http://gradle.1045684.n5.nabble.com/source-set-depends-on-another-source-set-td1436006.html
*/
[sourceSets.main, sourceSets.test].each {
// compile java and groovy file at same time.
it.groovy.srcDirs += it.java.srcDirs
// disable java compilation
it.java.srcDirs = []
}
// for Tomcat context auto reloading, change class file output path to '/WEB-INF/classes'
sourceSets.main.output.classesDir = 'src/main/webapp/WEB-INF/classes'
clean {
// add customized class output path to deletion targets of 'clean' task.
delete << 'src/main/webapp/WEB-INF/classes'
}
/* See:
* http://java.dzone.com/articles/gradle-goodness-set-java
* http://www.gradle.org/docs/current/dsl/org.gradle.api.tasks.compile.CompileOptions.html
*/
tasks.withType(Compile) {
sourceCompatibility = '1.7'
targetCompatibility = '1.7'
options.encoding = 'UTF-8'
options.debug = true
}
dependencies {
compile 'org.codehaus.groovy:groovy-all:1.8.9'
compile 'commons-lang:commons-lang:20030203.000129'
compile 'org.slf4j:slf4j-api:1.7.2'
compile 'ch.qos.logback:logback-classic:1.0.9'
providedCompile 'javax.servlet:servlet-api:2.5'
providedCompile 'javax.servlet.jsp:jsp-api:2.1'
testCompile 'junit:junit:4.11'
// See: https://github.com/bmuschko/gradle-tomcat-plugin
// def tomcatVersion = '6.0.36'
// tomcat "org.apache.tomcat:catalina:${tomcatVersion}",
// "org.apache.tomcat:coyote:${tomcatVersion}",
// "org.apache.tomcat:jasper:${tomcatVersion}"
def tomcatVersion = '7.0.37'
tomcat "org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}",
"org.apache.tomcat.embed:tomcat-embed-logging-juli:${tomcatVersion}"
tomcat("org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatVersion}") {
exclude group: 'org.eclipse.jdt.core.compiler', module: 'ecj'
}
}
war {
baseName = 'warsample1'
version = '1.0.0'
}
tomcatRun {
httpPort = 8090
reloadable = true
contextPath = '/warsample1'
}
jettyRun {
httpPort = 8190
}