build.gradle 29.3 KB
Newer Older
1
buildscript {
2
	repositories {
P
Phillip Webb 已提交
3
		maven { url "http://repo.springsource.org/plugins-release" }
4 5
	}
	dependencies {
6
		classpath("org.springframework.build.gradle:propdeps-plugin:0.0.1")
7
		classpath("org.springframework.build.gradle:docbook-reference-plugin:0.2.2")
8
	}
9 10
}

C
Chris Beams 已提交
11
configure(allprojects) {
P
Phillip Webb 已提交
12 13 14 15 16
	ext.aspectjVersion  = "1.6.12"
	ext.easymockVersion = "2.5.2"
	ext.hsqldbVersion   = "1.8.0.10"
	ext.junitVersion    = "4.11"
	ext.slf4jVersion    = "1.6.1"
17
	ext.gradleScriptDir = "${rootProject.projectDir}/gradle"
18

19
	apply plugin: "propdeps"
P
Phillip Webb 已提交
20
	apply plugin: "java"
21 22
	apply plugin: "propdeps-eclipse"
	apply plugin: "propdeps-idea"
23
	apply from: "${gradleScriptDir}/ide.gradle"
C
Chris Beams 已提交
24

P
Phillip Webb 已提交
25
	group = "org.springframework"
26

27 28
	sourceCompatibility=1.5
	targetCompatibility=1.5
C
Chris Beams 已提交
29

P
Phillip Webb 已提交
30
	[compileJava, compileTestJava]*.options*.compilerArgs = ["-Xlint:none"]
C
Chris Beams 已提交
31

P
Phillip Webb 已提交
32
	sourceSets.test.resources.srcDirs = ["src/test/resources", "src/test/java"]
C
Chris Beams 已提交
33

34
	test.systemProperty("java.awt.headless", "true")
C
Chris Beams 已提交
35

36 37 38 39
	repositories {
		maven { url "http://repo.springsource.org/libs-release" }
		maven { url "http://repo.springsource.org/ebr-maven-external" }
	}
C
Chris Beams 已提交
40

41
	dependencies {
42 43 44
		testCompile("org.hamcrest:hamcrest-all:1.3")
		testCompile("org.easymock:easymock:${easymockVersion}")
		testCompile("junit:junit:${junitVersion}") {
P
Phillip Webb 已提交
45
			exclude group: "org.hamcrest", module: "hamcrest-core"
46 47
		}
	}
48 49
}

50
configure(subprojects) { subproject ->
51 52 53
	apply from: "${gradleScriptDir}/publish-maven.gradle"

	jar {
P
Phillip Webb 已提交
54 55 56 57
		manifest.attributes["Created-By"] =
			"${System.getProperty("java.version")} (${System.getProperty("java.specification.vendor")})"
		manifest.attributes["Implementation-Title"] = subproject.name
		manifest.attributes["Implementation-Version"] = subproject.version
58 59 60 61 62

		from("${rootProject.projectDir}/src/dist") {
			include "license.txt"
			include "notice.txt"
			into "META-INF"
P
Phillip Webb 已提交
63
			expand(copyright: new Date().format("yyyy"), version: project.version)
64 65 66 67 68 69 70 71 72 73 74
		}
	}

	javadoc {
		options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
		options.author = true
		options.header = project.name
		//options.overview = "${projectDir}/src/main/java/overview.html"
	}

	task sourcesJar(type: Jar, dependsOn:classes) {
P
Phillip Webb 已提交
75
		classifier = "sources"
76
		from sourceSets.main.allJava.srcDirs
P
Phillip Webb 已提交
77
		include "**/*.java", "**/*.aj"
78 79 80
	}

	task javadocJar(type: Jar) {
P
Phillip Webb 已提交
81
		classifier = "javadoc"
82 83 84 85 86 87 88
		from javadoc
	}

	artifacts {
		archives sourcesJar
		archives javadocJar
	}
C
Chris Beams 已提交
89 90 91
}


P
Phillip Webb 已提交
92 93
project("spring-core") {
	description = "Spring Core"
94 95 96 97 98 99 100

	// As of Spring 3.2 spring-core repackages both asm 4.0 and cglib 3.0 and inlines both
	// into the spring-core jar. cglib 3.0 itself depends on asm 4.0, and is therefore
	// further transformed by the JarJar task to depend on org.springframework.asm; this
	// avoids including two different copies of asm unnecessarily. If however future cglib
	// versions drift from the version of asm used by Spring internally, this duplication
	// will become necessary.
P
Phillip Webb 已提交
101 102
	def asmVersion = "4.0"
	def cglibVersion = "3.0"
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121

	configurations {
		jarjar
		asm
		cglib
	}

	task asmRepackJar(type: Jar) { repackJar ->
		repackJar.baseName = "spring-asm-repack"
		repackJar.version = asmVersion

		doLast() {
			project.ant {
				taskdef name: "jarjar", classname: "com.tonicsystems.jarjar.JarJarTask",
					classpath: configurations.jarjar.asPath
				jarjar(destfile: repackJar.archivePath) {
					configurations.asm.each { originalJar ->
						zipfileset(src: originalJar)
					}
P
Phillip Webb 已提交
122
					rule(pattern: "org.objectweb.asm.**", result: "org.springframework.asm.@1")
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
				}
			}
		}
	}

	task cglibRepackJar(type: Jar) { repackJar ->
		repackJar.baseName = "spring-cglib-repack"
		repackJar.version = cglibVersion

		doLast() {
			project.ant {
				taskdef name: "jarjar", classname: "com.tonicsystems.jarjar.JarJarTask",
					classpath: configurations.jarjar.asPath
				jarjar(destfile: repackJar.archivePath) {
					configurations.cglib.each { originalJar ->
						zipfileset(src: originalJar)
					}
					// repackage net.sf.cglib => org.springframework.cglib
P
Phillip Webb 已提交
141 142
					rule(pattern: "net.sf.cglib.**", result: "org.springframework.cglib.@1")
					// as mentioned above, transform cglib"s internal asm dependencies from
143 144
					// org.objectweb.asm => org.springframework.asm. Doing this counts on the
					// the fact that Spring and cglib depend on the same version of asm!
P
Phillip Webb 已提交
145
					rule(pattern: "org.objectweb.asm.**", result: "org.springframework.asm.@1")
146 147 148 149 150 151
				}
			}
		}
	}

	dependencies {
152 153 154 155
		asm("org.ow2.asm:asm:${asmVersion}@jar")
		asm("org.ow2.asm:asm-commons:${asmVersion}@jar")
		cglib("cglib:cglib:${cglibVersion}@jar")
		jarjar("com.googlecode.jarjar:jarjar:1.3")
156

157 158
		compile(files(asmRepackJar))
		compile("commons-logging:commons-logging:1.1.1")
159 160
		optional("org.aspectj:aspectjweaver:${aspectjVersion}")
		optional("net.sf.jopt-simple:jopt-simple:3.0") {
P
Phillip Webb 已提交
161
			exclude group: "org.apache.ant", module: "ant"
162
		}
163
		optional("log4j:log4j:1.2.17")
164 165
		testCompile("xmlunit:xmlunit:1.2")
		testCompile("org.codehaus.woodstox:wstx-asl:3.2.7")
166 167 168 169 170 171
	}

	jar {
		// inline all repackaged asm and cglib classes directly into the spring-core jar
		dependsOn asmRepackJar
		from(zipTree(asmRepackJar.archivePath)) {
P
Phillip Webb 已提交
172
			include "org/springframework/asm/**"
173 174 175
		}
		dependsOn cglibRepackJar
		from(zipTree(cglibRepackJar.archivePath)) {
P
Phillip Webb 已提交
176
			include "org/springframework/cglib/**"
177 178
		}
	}
C
Chris Beams 已提交
179 180
}

P
Phillip Webb 已提交
181 182
project("spring-beans") {
	description = "Spring Beans"
183
	dependencies {
184 185
		compile(project(":spring-core"))
		compile(files(project(":spring-core").cglibRepackJar))
186 187 188
		provided("javax.el:el-api:1.0")
		provided("javax.inject:javax.inject:1")
		testCompile("log4j:log4j:1.2.17")
189
	}
C
Chris Beams 已提交
190 191
}

P
Phillip Webb 已提交
192 193
project("spring-aop") {
	description = "Spring AOP"
194
	dependencies {
195 196 197
		compile(project(":spring-core"))
		compile(files(project(":spring-core").cglibRepackJar))
		compile(project(":spring-beans"))
198
		compile("aopalliance:aopalliance:1.0")
199 200 201
		optional("com.jamonapi:jamon:2.4")
		optional("commons-pool:commons-pool:1.5.3")
		optional("org.aspectj:aspectjweaver:${aspectjVersion}")
202
	}
C
Chris Beams 已提交
203 204
}

P
Phillip Webb 已提交
205 206
project("spring-expression") {
	description = "Spring Expression Language (SpEL)"
207
	dependencies {
208
		compile(project(":spring-core"))
209
	}
C
Chris Beams 已提交
210 211
}

P
Phillip Webb 已提交
212 213
project("spring-instrument") {
	description = "Spring Instrument"
214
	dependencies {
215
		compile(project(":spring-core"))
216 217
	}
	jar {
P
Phillip Webb 已提交
218 219
		manifest.attributes["Premain-Class"] =
			"org.springframework.instrument.InstrumentationSavingAgent"
220
	}
C
Chris Beams 已提交
221 222
}

P
Phillip Webb 已提交
223 224
project("spring-instrument-tomcat") {
	description = "Spring Instrument Tomcat"
225
	dependencies {
226
		provided("org.apache.tomcat:catalina:6.0.16")
227
	}
C
Chris Beams 已提交
228 229
}

P
Phillip Webb 已提交
230 231
project("spring-context") {
	description = "Spring Context"
232
	dependencies {
233
		optional(project(":spring-instrument"))
234 235 236 237 238
		compile(project(":spring-aop"))
		compile(project(":spring-beans"))
		compile(project(":spring-expression"))
		compile(project(":spring-core"))
		compile(files(project(":spring-core").cglibRepackJar))
239 240 241 242 243 244 245 246 247 248 249 250
		optional("backport-util-concurrent:backport-util-concurrent:3.0")
		optional("javax.ejb:ejb-api:3.0")
		optional("javax.inject:javax.inject:1")
		optional("org.apache.geronimo.specs:geronimo-jms_1.1_spec:1.1")
		optional("javax.persistence:persistence-api:1.0")
		optional("javax.validation:validation-api:1.0.0.GA")
		optional("org.beanshell:bsh:2.0b4")
		optional("org.codehaus.groovy:groovy-all:1.8.8")
		optional("org.jruby:jruby:1.6.5.1")
		optional("joda-time:joda-time:2.1")
		optional("org.slf4j:slf4j-api:${slf4jVersion}")
		optional("org.hibernate:hibernate-validator:4.3.0.Final") {
P
Phillip Webb 已提交
251
			exclude group: "org.slf4j", module: "slf4j-api"
252
		}
253 254
		optional("org.aspectj:aspectjweaver:${aspectjVersion}")
		optional("org.apache.geronimo.specs:geronimo-jta_1.1_spec:1.1")
255
		testCompile("commons-dbcp:commons-dbcp:1.2.2")
256 257 258 259
		testCompile("javax.inject:com.springsource.org.atinject.tck:1.0.0")
	}

	test {
P
Phillip Webb 已提交
260
		jvmArgs = ["-disableassertions:org.aspectj.weaver.UnresolvedType"] // SPR-7989
261
	}
C
Chris Beams 已提交
262 263
}

P
Phillip Webb 已提交
264 265
project("spring-tx") {
	description = "Spring Transaction"
266
	dependencies {
267 268
		optional(project(":spring-context")) // for JCA, @EnableTransactionManagement
		optional(project(":spring-aop"))
269 270
		compile(project(":spring-beans"))
		compile(project(":spring-core"))
271
		compile("aopalliance:aopalliance:1.0")
272 273 274 275 276 277 278
		provided("com.ibm.websphere:uow:6.0.2.17")
		optional("javax.resource:connector-api:1.5")
		optional("org.apache.geronimo.specs:geronimo-jta_1.1_spec:1.1")
		optional("javax.ejb:ejb-api:3.0")
		testCompile "org.easymock:easymockclassextension:${easymockVersion}"
		testCompile("javax.persistence:persistence-api:1.0")
		testCompile("org.aspectj:aspectjweaver:${aspectjVersion}")
279
	}
C
Chris Beams 已提交
280 281
}

P
Phillip Webb 已提交
282 283 284
project("spring-oxm") {
	description = "Spring Object/XML Marshalling"
	apply from: "oxm.gradle"
285
	dependencies {
286 287
		compile(project(":spring-beans"))
		compile(project(":spring-core"))
288
		optional(project(":spring-context")) // for Jaxb2Marshaller
289
		compile("commons-lang:commons-lang:2.5")
290 291 292 293 294
		optional("com.thoughtworks.xstream:xstream:1.3.1")
		optional("com.sun.xml.bind:jaxb-impl:2.1.7")
		optional("org.jibx:jibx-run:1.2.3")
		optional("org.apache.xmlbeans:xmlbeans:2.4.0")
		optional("org.codehaus.castor:castor-xml:1.3.2")
295 296 297
		testCompile("org.codehaus.jettison:jettison:1.0.1")
		testCompile("xmlunit:xmlunit:1.2")
		testCompile("xmlpull:xmlpull:1.1.3.4a")
298 299 300 301
		testCompile(files(genCastor.classesDir).builtBy(genCastor))
		testCompile(files(genJaxb.classesDir).builtBy(genJaxb))
		testCompile(files(genXmlbeans.classesDir).builtBy(genXmlbeans))
	}
C
Chris Beams 已提交
302 303
}

P
Phillip Webb 已提交
304 305
project("spring-jms") {
	description = "Spring JMS"
306
	dependencies {
307 308 309 310 311
		compile(project(":spring-core"))
		compile(project(":spring-beans"))
		compile(project(":spring-aop"))
		compile(project(":spring-context"))
		compile(project(":spring-tx"))
312
		optional(project(":spring-oxm"))
313
		compile("aopalliance:aopalliance:1.0")
314 315 316 317
		optional("org.codehaus.jackson:jackson-mapper-asl:1.4.2")
		provided("org.apache.geronimo.specs:geronimo-jms_1.1_spec:1.1")
		optional("org.apache.geronimo.specs:geronimo-jta_1.1_spec:1.1")
		optional("javax.resource:connector-api:1.5")
318
	}
C
Chris Beams 已提交
319 320
}

P
Phillip Webb 已提交
321 322
project("spring-jdbc") {
	description = "Spring JDBC"
323
	dependencies {
324 325
		compile(project(":spring-core"))
		compile(project(":spring-beans"))
326
		optional(project(":spring-context")) // for JndiDataSourceLookup
327
		compile(project(":spring-tx"))
328 329 330 331 332 333
		optional("c3p0:c3p0:0.9.1.2")
		optional("hsqldb:hsqldb:${hsqldbVersion}")
		optional("com.h2database:h2:1.0.71")
		optional("org.apache.derby:derby:10.5.3.0_1")
		optional("org.apache.derby:derbyclient:10.5.3.0_1")
		optional("org.apache.geronimo.specs:geronimo-jta_1.1_spec:1.1")
334
	}
C
Chris Beams 已提交
335 336
}

P
Phillip Webb 已提交
337 338
project("spring-context-support") {
	description = "Spring Context Support"
339
	dependencies {
340 341 342
		compile(project(":spring-core"))
		compile(project(":spring-beans"))
		compile(project(":spring-context"))
343 344 345 346 347 348 349 350 351 352 353
		optional(project(":spring-jdbc")) // for Quartz support
		optional(project(":spring-tx")) // for Quartz support
		optional("javax.mail:mail:1.4")
		optional("javax.cache:cache-api:0.5")
		optional("net.sf.ehcache:ehcache-core:2.0.0")
		optional("opensymphony:quartz:1.6.2")
		optional("org.codehaus.fabric3.api:commonj:1.1.0")
		optional("velocity:velocity:1.5")
		optional("org.freemarker:freemarker:2.3.15")
		optional("com.lowagie:itext:2.1.7")
		optional("jasperreports:jasperreports:2.0.5") {
354
			transitive = false
355
			exclude group: "bouncycastle", module: "bctsp-jdk14"
356
		}
357 358
		optional("org.slf4j:slf4j-api:${slf4jVersion}")
		provided("javax.activation:activation:1.1")
359
		testCompile("org.apache.poi:poi:3.0.2-FINAL") {
P
Phillip Webb 已提交
360
			exclude group: "log4j", module: "log4j"
361 362 363
		}
		testCompile("commons-beanutils:commons-beanutils:1.8.0") // for Velocity/JasperReports
		testCompile("commons-digester:commons-digester:1.8.1") // for Velocity/JasperReports
364
		testCompile("hsqldb:hsqldb:${hsqldbVersion}")
365 366 367
	}

	// pick up **/*.types files in src/main
P
Phillip Webb 已提交
368
	sourceSets.main.resources.srcDirs += "src/main/java"
C
Chris Beams 已提交
369 370
}

P
Phillip Webb 已提交
371 372
project("spring-web") {
	description = "Spring Web"
373
	dependencies {
374 375 376 377
		compile(project(":spring-core"))
		compile(project(":spring-beans")) // for MultiPartFilter
		compile(project(":spring-aop")) // for JaxWsPortProxyFactoryBean
		compile(project(":spring-context"))
378
		optional(project(":spring-oxm")) // for MarshallingHttpMessageConverter
379
		compile("aopalliance:aopalliance:1.0")
380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397
		optional("com.caucho:hessian:3.2.1")
		optional("rome:rome:1.0")
		optional("javax.el:el-api:1.0")
		optional("javax.faces:jsf-api:1.2_08")
		provided("javax.portlet:portlet-api:2.0")
		provided("javax.servlet:javax.servlet-api:3.0.1")
		provided("javax.servlet.jsp:jsp-api:2.1")
		optional("javax.xml:jaxrpc-api:1.1")
		provided("javax.xml.soap:saaj-api:1.3")
		provided("javax.activation:activation:1.1")
		optional("commons-fileupload:commons-fileupload:1.2")
		optional("commons-io:commons-io:1.3")
		optional("commons-httpclient:commons-httpclient:3.1")
		optional("org.apache.httpcomponents:httpclient:4.2")
		optional("org.codehaus.jackson:jackson-mapper-asl:1.4.2")
		optional("com.fasterxml.jackson.core:jackson-databind:2.0.1")
		optional("taglibs:standard:1.1.2")
		optional("org.eclipse.jetty:jetty-servlet:8.1.5.v20120716") {
P
Phillip Webb 已提交
398
			exclude group: "org.eclipse.jetty.orbit", module: "javax.servlet"
399
		}
400
		optional("org.eclipse.jetty:jetty-server:8.1.5.v20120716") {
P
Phillip Webb 已提交
401
			exclude group: "org.eclipse.jetty.orbit", module: "javax.servlet"
402
		}
403
		optional("log4j:log4j:1.2.17")
404 405
		testCompile(project(":spring-context-support"))  // for JafMediaTypeFactory
		testCompile("xmlunit:xmlunit:1.2")
406 407 408
	}

	// pick up ContextLoader.properties in src/main
P
Phillip Webb 已提交
409
	sourceSets.main.resources.srcDirs += "src/main/java"
C
Chris Beams 已提交
410 411
}

P
Phillip Webb 已提交
412 413
project("spring-orm") {
	description = "Spring Object/Relational Mapping"
414 415
	dependencies {
		compile("aopalliance:aopalliance:1.0")
416 417 418 419 420 421 422 423 424 425 426 427
		optional("org.hibernate:hibernate-core:3.3.2.GA")
		optional("org.hibernate:hibernate-annotations:3.4.0.GA")
		optional("org.hibernate:hibernate-entitymanager:3.4.0.GA")
		optional("org.apache.openjpa:openjpa:1.1.0")
		optional("org.eclipse.persistence:org.eclipse.persistence.core:1.0.1")
		optional("org.eclipse.persistence:org.eclipse.persistence.jpa:1.0.1")
		optional("toplink.essentials:toplink-essentials:2.0-41b")
		optional("javax.jdo:jdo-api:3.0")
		optional("org.apache.ibatis:ibatis-sqlmap:2.3.4.726")
		optional("javax.persistence:persistence-api:1.0")
		provided("javax.servlet:servlet-api:2.5")
		testCompile("javax.servlet:javax.servlet-api:3.0.1")
428 429 430 431
		testCompile("org.slf4j:slf4j-jcl:${slf4jVersion}")
		testCompile("commons-dbcp:commons-dbcp:1.2.2")
		testCompile("org.eclipse.persistence:org.eclipse.persistence.asm:1.0.1")
		testCompile("org.eclipse.persistence:org.eclipse.persistence.antlr:1.0.1")
432
		testCompile("hsqldb:hsqldb:${hsqldbVersion}")
433 434 435
		testCompile(project(":spring-web").sourceSets.test.output)
		compile(project(":spring-core"))
		compile(project(":spring-beans"))
436 437
		optional(project(":spring-aop"))
		optional(project(":spring-context"))
438 439
		compile(project(":spring-tx"))
		compile(project(":spring-jdbc"))
440
		optional(project(":spring-web")) {
P
Phillip Webb 已提交
441
			exclude group: "javax.persistence", module: "persistence-api"
442 443
		}
	}
C
Chris Beams 已提交
444 445
}

P
Phillip Webb 已提交
446 447 448
project("spring-orm-hibernate4") {
	description = "Spring Object/Relational Mapping - Hibernate 4 support"
	ext.mergeIntoProject = project(":spring-orm")
449 450
	apply from: "${gradleScriptDir}/merge-artifacts.gradle"
	dependencies {
451 452 453
		compile(project(":spring-orm").sourceSets.main.output)
		compile(project(":spring-tx"))
		compile(project(":spring-jdbc"))
454 455 456
		optional("org.hibernate:hibernate-core:4.1.0.Final")
		optional("org.hibernate:hibernate-entitymanager:4.1.0.Final")
		optional(project(":spring-web")) {
P
Phillip Webb 已提交
457
			exclude group: "javax.persistence", module: "persistence-api"
458
		}
459
		optional("javax.servlet:servlet-api:2.5")
460
	}
461 462
}

P
Phillip Webb 已提交
463 464
project("spring-webmvc") {
	description = "Spring Web MVC"
465
	dependencies {
466 467 468 469 470
		compile(project(":spring-core"))
		compile(project(":spring-expression"))
		compile(project(":spring-beans"))
		compile(project(":spring-web"))
		compile(project(":spring-context"))
471 472 473 474 475 476 477 478 479 480 481 482 483
		optional(project(":spring-context-support")) // for Velocity support
		optional(project(":spring-oxm")) // for MarshallingView
		optional("org.apache.tiles:tiles-api:2.1.2")
		optional("org.apache.tiles:tiles-core:2.1.2")
		optional("org.apache.tiles:tiles-jsp:2.1.2")
		optional("org.apache.tiles:tiles-servlet:2.1.2")
		optional("velocity-tools:velocity-tools-view:1.4")
		optional("net.sourceforge.jexcelapi:jxl:2.6.3")
		optional("org.apache.poi:poi:3.0.2-FINAL")
		optional("com.lowagie:itext:2.1.7")
		optional("jasperreports:jasperreports:2.0.5") {
			transitive = false
			exclude group: "xml-apis", module: "xml-apis"
484
		}
485 486 487 488 489 490 491 492
		optional("rome:rome:1.0")
		optional("velocity:velocity:1.5")
		optional("org.freemarker:freemarker:2.3.15")
		optional("org.codehaus.jackson:jackson-mapper-asl:1.4.2")
		optional("com.fasterxml.jackson.core:jackson-databind:2.0.1")
		provided("javax.servlet:jstl:1.2")
		provided("javax.servlet:javax.servlet-api:3.0.1")
		provided("javax.servlet.jsp:jsp-api:2.1")
493 494 495 496
		testCompile(project(":spring-aop"))
		testCompile("org.slf4j:slf4j-jcl:${slf4jVersion}")
		testCompile("rhino:js:1.7R1")
		testCompile("xmlunit:xmlunit:1.2")
497
		testCompile("dom4j:dom4j:1.6.1") {
P
Phillip Webb 已提交
498
			exclude group: "xml-apis", module: "xml-apis"
499 500
		}
		testCompile("jaxen:jaxen:1.1.1") {
P
Phillip Webb 已提交
501 502 503
			exclude group: "xml-apis", module: "xml-apis"
			exclude group: "xom", module: "xom"
			exclude group: "xerces", module: "xercesImpl"
504
		}
505 506 507 508 509 510 511 512 513 514 515
		testCompile("org.eclipse.jetty:jetty-servlet:8.1.5.v20120716") {
			exclude group: "org.eclipse.jetty.orbit", module: "javax.servlet"
		}
		testCompile("org.eclipse.jetty:jetty-server:8.1.5.v20120716") {
			exclude group: "org.eclipse.jetty.orbit", module: "javax.servlet"
		}
		testCompile("javax.validation:validation-api:1.0.0.GA")
		testCompile("commons-fileupload:commons-fileupload:1.2")
		testCompile("commons-io:commons-io:1.3")
		testCompile("org.hibernate:hibernate-validator:4.3.0.Final")
		testCompile("org.apache.httpcomponents:httpclient:4.2")
516
		testCompile(project(":spring-web").sourceSets.test.output)
517 518 519
	}

	// pick up DispatcherServlet.properties in src/main
P
Phillip Webb 已提交
520
	sourceSets.main.resources.srcDirs += "src/main/java"
C
Chris Beams 已提交
521 522
}

P
Phillip Webb 已提交
523 524 525
project("spring-webmvc-tiles3") {
	description = "Spring Framework Tiles3 Integration"
	ext.mergeIntoProject = project(":spring-webmvc")
526 527
	apply from: "${gradleScriptDir}/merge-artifacts.gradle"
	dependencies {
528 529
		compile(project(":spring-context"))
		compile(project(":spring-webmvc").sourceSets.main.output)
530 531 532 533 534 535
		provided("javax.el:el-api:1.0")
		provided("javax.servlet:jstl:1.2")
		provided("javax.servlet.jsp:jsp-api:2.1")
		optional("org.apache.tiles:tiles-request-api:1.0.1")
		optional("org.apache.tiles:tiles-api:3.0.1")
		optional("org.apache.tiles:tiles-core:3.0.1") {
P
Phillip Webb 已提交
536
			exclude group: "org.slf4j", module: "jcl-over-slf4j"
537
		}
538
		optional("org.apache.tiles:tiles-servlet:3.0.1") {
P
Phillip Webb 已提交
539
			exclude group: "org.slf4j", module: "jcl-over-slf4j"
540
		}
541
		optional("org.apache.tiles:tiles-jsp:3.0.1") {
P
Phillip Webb 已提交
542
			exclude group: "org.slf4j", module: "jcl-over-slf4j"
543
		}
544
		optional("org.apache.tiles:tiles-el:3.0.1") {
P
Phillip Webb 已提交
545
			exclude group: "org.slf4j", module: "jcl-over-slf4j"
546
		}
547
		provided("javax.servlet:javax.servlet-api:3.0.1")
548
		compile(project(":spring-web").sourceSets*.output) // mock request & response
549
		testCompile("org.slf4j:slf4j-jcl:${slf4jVersion}")
550
	}
551 552
}

P
Phillip Webb 已提交
553 554
project("spring-webmvc-portlet") {
	description = "Spring Web Portlet"
555
	dependencies {
556 557
		provided("javax.servlet:servlet-api:2.5")
		provided("javax.portlet:portlet-api:2.0")
558 559 560 561 562
		compile(project(":spring-core"))
		compile(project(":spring-beans"))
		compile(project(":spring-context"))
		compile(project(":spring-web"))
		compile(project(":spring-webmvc"))
563
		optional("commons-fileupload:commons-fileupload:1.2")
564 565 566
	}

	// pick up DispatcherPortlet.properties in src/main
P
Phillip Webb 已提交
567
	sourceSets.main.resources.srcDirs += "src/main/java"
C
Chris Beams 已提交
568 569
}

P
Phillip Webb 已提交
570 571
project("spring-test") {
	description = "Spring TestContext Framework"
572
	dependencies {
573
		compile(project(":spring-core"))
574 575 576 577 578 579 580 581 582
		optional(project(":spring-beans"))
		optional(project(":spring-context"))
		optional(project(":spring-jdbc"))
		optional(project(":spring-tx"))
		optional(project(":spring-orm"))
		optional(project(":spring-web"))
		optional(project(":spring-webmvc"))
		optional(project(":spring-webmvc-portlet"), )
		optional("junit:junit:${junitVersion}") {
583
			// We already have hamcrest-all as a global testCompile dependency.
P
Phillip Webb 已提交
584
			exclude group: "org.hamcrest", module: "hamcrest-core"
585
		}
586
		optional("org.testng:testng:6.5.2") {
P
Phillip Webb 已提交
587
			exclude group: "junit", module: "junit"
588
			// We already have hamcrest-all as a global testCompile dependency.
P
Phillip Webb 已提交
589
			exclude group: "org.hamcrest", module: "hamcrest-core"
590
		}
591 592 593 594 595 596 597 598 599 600 601
		optional("javax.servlet:servlet-api:2.5")
		optional("javax.servlet.jsp:jsp-api:2.1")
		optional("javax.portlet:portlet-api:2.0")
		optional("javax.persistence:persistence-api:1.0")
		optional("org.aspectj:aspectjweaver:${aspectjVersion}")
		testCompile("org.hibernate:hibernate-core:3.3.2.GA")
		provided("javax.inject:javax.inject:1")
		provided("javax.activation:activation:1.1")
		provided("javax.servlet:jstl:1.2")
		testCompile "org.slf4j:slf4j-jcl:${slf4jVersion}"
		testCompile("hsqldb:hsqldb:${hsqldbVersion}")
602
	}
C
Chris Beams 已提交
603 604
}

P
Phillip Webb 已提交
605 606 607
project("spring-test-mvc") {
	description = "Spring Test MVC Framework"
	ext.mergeIntoProject = project(":spring-test")
608 609 610
	apply from: "${gradleScriptDir}/merge-artifacts.gradle"
	apply from: "ide.gradle"
	dependencies {
611
		optional(project(":spring-context"))
612 613
		compile(project(":spring-webmvc"))
		compile(project(":spring-test").sourceSets.main.output)
614 615 616 617 618
		provided("javax.servlet:javax.servlet-api:3.0.1")
		optional("org.hamcrest:hamcrest-core:1.3")
		optional("com.jayway.jsonpath:json-path:0.8.1")
		optional("xmlunit:xmlunit:1.2")
		testCompile("org.slf4j:slf4j-jcl:${slf4jVersion}")
619 620 621
		testCompile("javax.servlet:jstl:1.2")
		testCompile("org.hibernate:hibernate-validator:4.3.0.Final")
		testCompile("org.codehaus.jackson:jackson-mapper-asl:1.4.2")
622 623
		testCompile("com.fasterxml.jackson.core:jackson-databind:2.0.1")
		testCompile(project(":spring-context-support"))
624 625 626 627
		testCompile(project(":spring-oxm"))
		testCompile("com.thoughtworks.xstream:xstream:1.3.1")
		testCompile("cglib:cglib-nodep:2.2")
		testCompile("rome:rome:1.0")
628 629
		testCompile("javax.activation:activation:1.1")
		testCompile("javax.mail:mail:1.4")
630 631 632 633
		testCompile("javax.xml.bind:jaxb-api:2.2.6")
		testCompile("org.easymock:easymockclassextension:${easymockVersion}")
		testCompile("org.apache.tiles:tiles-request-api:1.0.1")
		testCompile("org.apache.tiles:tiles-api:3.0.1")
634
		testCompile("org.apache.tiles:tiles-core:3.0.1") {
P
Phillip Webb 已提交
635
			exclude group: "org.slf4j", module: "jcl-over-slf4j"
636 637
		}
		testCompile("org.apache.tiles:tiles-servlet:3.0.1") {
P
Phillip Webb 已提交
638
			exclude group: "org.slf4j", module: "jcl-over-slf4j"
639 640
		}
	}
R
Rob Winch 已提交
641 642
}

P
Phillip Webb 已提交
643 644
project("spring-struts") {
	description = "Spring Struts"
645
	dependencies {
646 647 648 649 650 651 652
		compile(project(":spring-core"))
		compile(project(":spring-beans"))
		compile(project(":spring-context"))
		compile(project(":spring-web"))
		compile(project(":spring-webmvc"))
		compile("struts:struts:1.2.9")
		compile("commons-beanutils:commons-beanutils:1.7.0")
653 654
		provided("javax.servlet:servlet-api:2.5")
		provided("javax.servlet:jstl:1.2")
655
		testCompile(project(":spring-test"))
656
	}
C
Chris Beams 已提交
657 658
}

P
Phillip Webb 已提交
659 660 661
project("spring-aspects") {
	description = "Spring Aspects"
	apply from: "aspects.gradle"
662
	dependencies {
663 664 665 666 667 668
		optional(project(":spring-beans")) // for @Configurable support
		optional(project(":spring-aop")) // for @Async support
		optional(project(":spring-context")) // for @Enable* support
		compile(project(":spring-context-support")) // for JavaMail support
		optional(project(":spring-tx")) // for JPA, @Transactional support
		optional(project(":spring-orm")) // for JPA exception translation support
669
		aspects(project(":spring-orm"))
670 671
		provided("javax.persistence:persistence-api:1.0")
		testCompile("javax.mail:mail:1.4")
672 673 674 675 676
		ajc("org.aspectj:aspectjtools:${aspectjVersion}")
		compile("org.aspectj:aspectjweaver:${aspectjVersion}")
		testCompile(project(":spring-core")) // for CodeStyleAspect
		compile(project(":spring-beans")) // for "p" namespace visibility
		testCompile(project(":spring-test"))
677 678
	}
	eclipse.project {
P
Phillip Webb 已提交
679
		natures += "org.eclipse.ajdt.ui.ajnature"
680
		buildCommands = [new org.gradle.plugins.ide.eclipse.model.
P
Phillip Webb 已提交
681
				BuildCommand("org.eclipse.ajdt.core.ajbuilder")]
682
	}
C
Chris Beams 已提交
683 684
}

685
configure(rootProject) {
P
Phillip Webb 已提交
686
	description = "Spring Framework"
687

P
Phillip Webb 已提交
688
	apply plugin: "docbook-reference"
689 690 691
	apply from: "${gradleScriptDir}/jdiff.gradle"

	reference {
P
Phillip Webb 已提交
692 693
		sourceDir = file("src/reference/docbook")
		pdfFilename = "spring-framework-reference.pdf"
694 695
	}

P
Phillip Webb 已提交
696
	// don"t publish the default jar for the root project
697 698 699
	configurations.archives.artifacts.clear()

	dependencies { // for integration tests
700 701 702 703 704 705 706 707 708 709
		testCompile(project(":spring-core"))
		testCompile(project(":spring-beans"))
		testCompile(project(":spring-aop"))
		testCompile(project(":spring-expression"))
		testCompile(project(":spring-context"))
		testCompile(project(":spring-tx"))
		testCompile(project(":spring-jdbc"))
		testCompile(project(":spring-test"))
		testCompile(project(":spring-web"))
		testCompile(project(":spring-webmvc-portlet"))
710
		testCompile(project(":spring-orm"))
711 712
		testCompile("org.hibernate:hibernate-core:4.1.0.Final")
		testCompile("javax.servlet:servlet-api:2.5")
713 714 715 716 717
		testCompile("javax.portlet:portlet-api:2.0")
		testCompile("javax.inject:javax.inject:1")
		testCompile("javax.resource:connector-api:1.5")
		testCompile("org.aspectj:aspectjweaver:${aspectjVersion}")
		testCompile("hsqldb:hsqldb:${hsqldbVersion}")
718 719 720
	}

	task api(type: Javadoc) {
P
Phillip Webb 已提交
721 722
		group = "Documentation"
		description = "Generates aggregated Javadoc API documentation."
723 724 725 726
		title = "${rootProject.description} ${version} API"
		options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
		options.author = true
		options.header = rootProject.description
P
Phillip Webb 已提交
727
		options.overview = "src/api/overview.html"
728 729
		options.splitIndex = true
		options.links(
P
Phillip Webb 已提交
730
			"http://docs.jboss.org/jbossas/javadoc/4.0.5/connector"
731 732 733 734 735 736 737 738
		)
		source subprojects.collect { project ->
			project.sourceSets.main.allJava
		}
		destinationDir = new File(buildDir, "api")
		classpath = files(subprojects.collect { project ->
			project.sourceSets.main.compileClasspath
		})
P
Phillip Webb 已提交
739
		maxMemory = "1024m"
740 741 742
	}

	task docsZip(type: Zip) {
P
Phillip Webb 已提交
743 744 745
		group = "Distribution"
		baseName = "spring-framework"
		classifier = "docs"
746 747 748
		description = "Builds -${classifier} archive containing api and reference " +
			"for deployment at http://static.springframework.org/spring-framework/docs."

P
Phillip Webb 已提交
749 750
		from("src/dist") {
			include "changelog.txt"
751 752 753
		}

		from (api) {
P
Phillip Webb 已提交
754
			into "api"
755 756 757
		}

		from (reference) {
P
Phillip Webb 已提交
758
			into "reference"
759 760 761 762
		}
	}

	task schemaZip(type: Zip) {
P
Phillip Webb 已提交
763 764 765
		group = "Distribution"
		baseName = "spring-framework"
		classifier = "schema"
766 767 768 769 770 771 772
		description = "Builds -${classifier} archive containing all " +
			"XSDs for deployment at http://springframework.org/schema."

		subprojects.each { subproject ->
			def Properties schemas = new Properties();

			subproject.sourceSets.main.resources.find {
P
Phillip Webb 已提交
773
				it.path.endsWith("META-INF/spring.schemas")
774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790
			}?.withInputStream { schemas.load(it) }

			for (def key : schemas.keySet()) {
				def shortName = key.replaceAll(/http.*schema.(.*).spring-.*/, '$1')
				assert shortName != key
				File xsdFile = subproject.sourceSets.main.resources.find {
					it.path.endsWith(schemas.get(key))
				}
				assert xsdFile != null
				into (shortName) {
					from xsdFile.path
				}
			}
		}
	}

	task distZip(type: Zip, dependsOn: [docsZip, schemaZip]) {
P
Phillip Webb 已提交
791 792 793
		group = "Distribution"
		baseName = "spring-framework"
		classifier = "dist"
794 795 796 797 798
		description = "Builds -${classifier} archive, containing all jars and docs, " +
					"suitable for community download page."

		ext.baseDir = "${baseName}-${project.version}";

P
Phillip Webb 已提交
799 800 801 802
		from("src/dist") {
			include "readme.txt"
			include "license.txt"
			include "notice.txt"
803
			into "${baseDir}"
P
Phillip Webb 已提交
804
			expand(copyright: new Date().format("yyyy"), version: project.version)
805 806 807 808 809 810 811 812 813 814 815 816 817
		}

		from(zipTree(docsZip.archivePath)) {
			into "${baseDir}/docs"
		}

		from(zipTree(schemaZip.archivePath)) {
			into "${baseDir}/schema"
		}

		subprojects.each { subproject ->
			into ("${baseDir}/libs") {
				from subproject.jar
P
Phillip Webb 已提交
818
				if (subproject.tasks.findByPath("sourcesJar")) {
819 820
					from subproject.sourcesJar
				}
P
Phillip Webb 已提交
821
				if (subproject.tasks.findByPath("javadocJar")) {
822 823 824 825 826 827 828 829 830
					from subproject.javadocJar
				}
			}
		}
	}

	// Create an distribution that contains all dependencies (required and optional).
	// Not published by default; only for use when building from source.
	task depsZip(type: Zip, dependsOn: distZip) { zipTask ->
P
Phillip Webb 已提交
831 832 833
		group = "Distribution"
		baseName = "spring-framework"
		classifier = "dist-with-deps"
834 835 836 837 838 839 840 841 842 843
		description = "Builds -${classifier} archive, containing everything " +
			"in the -${distZip.classifier} archive plus all runtime dependencies."

		from zipTree(distZip.archivePath)

		gradle.taskGraph.whenReady { taskGraph ->
			if (taskGraph.hasTask(":${zipTask.name}")) {
				def projectNames = rootProject.subprojects*.name
				def artifacts = new HashSet()
				subprojects.each { subproject ->
844 845
					(subproject.configurations.runtime.resolvedConfiguration.resolvedArtifacts +
					subproject.configurations.optional.resolvedConfiguration.resolvedArtifacts).each { artifact ->
846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866
						def dependency = artifact.moduleVersion.id
						if (!projectNames.contains(dependency.name)) {
							artifacts << artifact.file
						}
					}
				}

				zipTask.from(artifacts) {
					into "${distZip.baseDir}/deps"
				}
			}
		}
	}

	artifacts {
		archives docsZip
		archives schemaZip
		archives distZip
	}

	task wrapper(type: Wrapper) {
P
Phillip Webb 已提交
867 868
		description = "Generates gradlew[.bat] scripts"
		gradleVersion = "1.3"
869 870 871 872

		doLast() {
			def gradleOpts = "-XX:MaxPermSize=1024m -Xmx1024m"
			def gradleBatOpts = "$gradleOpts -XX:MaxHeapSize=256m"
P
Phillip Webb 已提交
873
			File wrapperFile = file("gradlew")
874 875
			wrapperFile.text = wrapperFile.text.replace("DEFAULT_JVM_OPTS=",
				"GRADLE_OPTS=\"$gradleOpts \$GRADLE_OPTS\"\nDEFAULT_JVM_OPTS=")
P
Phillip Webb 已提交
876
			File wrapperBatFile = file("gradlew.bat")
877 878 879 880
			wrapperBatFile.text = wrapperBatFile.text.replace("set DEFAULT_JVM_OPTS=",
				"set GRADLE_OPTS=$gradleBatOpts %GRADLE_OPTS%\nset DEFAULT_JVM_OPTS=")
		}
	}
881
}