build.gradle 32.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.3")
7
		classpath("org.springframework.build.gradle:docbook-reference-plugin:0.2.6")
8
	}
9 10
}

C
Chris Beams 已提交
11
configure(allprojects) { project ->
12 13 14
	group = "org.springframework"
	version = qualifyVersionIfNecessary(version)

S
Sam Brannen 已提交
15 16 17 18 19
	// The following is a work-around until the Gradle build uses
	// Ant 1.9.x by default. This is necessary to avoid the
	// "Class not found: javac1.8" issue with Ant versions prior to 1.9.x
	ant.properties["build.compiler"] = "javac1.7"

R
Rob Winch 已提交
20
	ext.aspectjVersion  = "1.7.2"
P
Phillip Webb 已提交
21 22 23
	ext.hsqldbVersion   = "1.8.0.10"
	ext.junitVersion    = "4.11"
	ext.slf4jVersion    = "1.6.1"
24
	ext.gradleScriptDir = "${rootProject.projectDir}/gradle"
25

26
	apply plugin: "propdeps"
P
Phillip Webb 已提交
27
	apply plugin: "java"
28
	apply plugin: "test-source-set-dependencies"
29
	apply from: "${gradleScriptDir}/ide.gradle"
C
Chris Beams 已提交
30

31
	compileJava {
32 33
		sourceCompatibility=1.6
		targetCompatibility=1.6
34 35
	}
	compileTestJava {
36 37
		sourceCompatibility=1.8
		targetCompatibility=1.8
38
	}
C
Chris Beams 已提交
39

40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
	[compileJava, compileTestJava]*.options*.compilerArgs = [
		"-Xlint:serial",
		"-Xlint:varargs",
		"-Xlint:cast",
		"-Xlint:classfile",
		"-Xlint:dep-ann",
		"-Xlint:divzero",
		"-Xlint:empty",
		"-Xlint:finally",
		"-Xlint:overrides",
		"-Xlint:path",
		"-Xlint:processing",
		"-Xlint:static",
		"-Xlint:try",
		"-Xlint:-options",     // intentionally disabled
		"-Xlint:-fallthrough", // intentionally disabled
		"-Xlint:-rawtypes",    // TODO enable and fix warnings
		"-Xlint:-deprecation", // TODO enable and fix warnings
		"-Xlint:-unchecked"    // TODO enable and fix warnings
	]
C
Chris Beams 已提交
60

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

C
Chris Beams 已提交
63 64
	test {
		systemProperty("java.awt.headless", "true")
65
		systemProperty("testGroups", project.properties.get("testGroups"))
66 67 68
		scanForTestClasses = false
		include '**/*Tests.*'
		exclude '**/*Abstract*.*'
C
Chris Beams 已提交
69
	}
C
Chris Beams 已提交
70

71 72 73
	repositories {
		maven { url "http://repo.springsource.org/libs-release" }
	}
C
Chris Beams 已提交
74

75
	dependencies {
76
		testCompile("junit:junit:${junitVersion}")
77
		testCompile("org.hamcrest:hamcrest-all:1.3")
78
		testCompile("org.mockito:mockito-core:1.9.5")
79
	}
C
Chris Beams 已提交
80 81 82 83 84

	ext.javadocLinks = [
		"http://docs.oracle.com/javase/6/docs/api",
		"http://docs.oracle.com/javaee/6/api",
		"http://portals.apache.org/pluto/portlet-2.0-apidocs/",
P
Phillip Webb 已提交
85 86 87 88 89 90
		"http://commons.apache.org/proper/commons-codec/apidocs/",
		"http://docs.jboss.org/jbossas/javadoc/4.0.5/connector/",
		"http://docs.jboss.org/jbossas/javadoc/7.1.2.Final/",
		"http://aopalliance.sourceforge.net/doc/",
		"http://glassfish.java.net/nonav/docs/v3/api/",
		"http://docs.oracle.com/cd/E13222_01/wls/docs90/javadocs/", // commonj
91
		"http://quartz-scheduler.org/api/2.1.7/",
C
Chris Beams 已提交
92
		"http://www.eclipse.org/aspectj/doc/released/aspectj5rt-api/",
93 94
		"http://fasterxml.github.com/jackson-core/javadoc/2.2.0/",
		"http://jackson.codehaus.org/1.9.12/javadoc/",
P
Phillip Webb 已提交
95 96 97
		"http://pic.dhe.ibm.com/infocenter/wasinfo/v7r0/topic/com.ibm.websphere.javadoc.doc/web/apidocs/",
		"http://tiles.apache.org/framework/apidocs/",
		"http://commons.apache.org/proper/commons-dbcp/apidocs/",
C
Chris Beams 已提交
98
	] as String[]
99 100
}

101
configure(subprojects - project(":spring-build-src")) { subproject ->
102
	apply plugin: "merge"
103 104 105
	apply from: "${gradleScriptDir}/publish-maven.gradle"

	jar {
P
Phillip Webb 已提交
106 107 108 109
		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
110 111 112 113 114

		from("${rootProject.projectDir}/src/dist") {
			include "license.txt"
			include "notice.txt"
			into "META-INF"
P
Phillip Webb 已提交
115
			expand(copyright: new Date().format("yyyy"), version: project.version)
116 117 118 119
		}
	}

	javadoc {
C
Chris Beams 已提交
120 121
		description = "Generates project-level javadoc for use in -javadoc jar"

122 123 124
		options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
		options.author = true
		options.header = project.name
C
Chris Beams 已提交
125
		options.links(project.ext.javadocLinks)
126
		options.addStringOption('Xdoclint:none', '-quiet')
C
Chris Beams 已提交
127 128 129 130 131

		// suppress warnings due to cross-module @see and @link references;
		// note that global 'api' task does display all warnings.
		logging.captureStandardError LogLevel.INFO
		logging.captureStandardOutput LogLevel.INFO // suppress "## warnings" message
132 133 134
	}

	task sourcesJar(type: Jar, dependsOn:classes) {
P
Phillip Webb 已提交
135
		classifier = "sources"
136
		from sourceSets.main.allJava.srcDirs
P
Phillip Webb 已提交
137
		include "**/*.java", "**/*.aj"
138 139 140
	}

	task javadocJar(type: Jar) {
P
Phillip Webb 已提交
141
		classifier = "javadoc"
142 143 144 145 146 147 148
		from javadoc
	}

	artifacts {
		archives sourcesJar
		archives javadocJar
	}
C
Chris Beams 已提交
149 150
}

151 152 153 154 155 156 157 158 159 160 161 162
project("spring-build-src") {
	description = "Exposes gradle buildSrc for IDE support"
	apply plugin: "groovy"

	dependencies {
		compile gradleApi()
		groovy localGroovy()
	}

	configurations.archives.artifacts.clear()
}

P
Phillip Webb 已提交
163 164
project("spring-core") {
	description = "Spring Core"
165

166 167
	// As of Spring 4.0, spring-core includes asm 4.1 and repackages cglib 3.0, inlining
	// both into the spring-core jar. cglib 3.0 itself depends on asm 4, and is therefore
168
	// further transformed by the JarJar task to depend on org.springframework.asm; this
169
	// avoids including two different copies of asm unnecessarily.
P
Phillip Webb 已提交
170
	def cglibVersion = "3.0"
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189

	configurations {
		jarjar
		cglib
	}

	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 已提交
190 191
					rule(pattern: "net.sf.cglib.**", result: "org.springframework.cglib.@1")
					// as mentioned above, transform cglib"s internal asm dependencies from
192 193
					// 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 已提交
194
					rule(pattern: "org.objectweb.asm.**", result: "org.springframework.asm.@1")
195 196 197 198 199 200
				}
			}
		}
	}

	dependencies {
201 202
		cglib("cglib:cglib:${cglibVersion}@jar")
		jarjar("com.googlecode.jarjar:jarjar:1.3")
203

P
Phillip Webb 已提交
204
		compile(files(cglibRepackJar))
205
		compile("commons-logging:commons-logging:1.1.1")
206
		optional("org.aspectj:aspectjweaver:${aspectjVersion}")
207
		optional("net.sf.jopt-simple:jopt-simple:3.0")
208
		optional("log4j:log4j:1.2.17")
P
Phillip Webb 已提交
209
		testCompile("xmlunit:xmlunit:1.3")
P
Phillip Webb 已提交
210 211 212
		testCompile("org.codehaus.woodstox:wstx-asl:3.2.7") {
			exclude group: "stax", module: "stax-api"
		}
213 214 215
	}

	jar {
216
		// inline repackaged cglib classes directly into the spring-core jar
217 218
		dependsOn cglibRepackJar
		from(zipTree(cglibRepackJar.archivePath)) {
P
Phillip Webb 已提交
219
			include "org/springframework/cglib/**"
220 221
		}
	}
C
Chris Beams 已提交
222 223
}

P
Phillip Webb 已提交
224 225
project("spring-beans") {
	description = "Spring Beans"
226

227
	dependencies {
228 229
		compile(project(":spring-core"))
		compile(files(project(":spring-core").cglibRepackJar))
230
		provided("javax.el:javax.el-api:2.2.4")
231 232
		provided("javax.inject:javax.inject:1")
		testCompile("log4j:log4j:1.2.17")
233
	}
C
Chris Beams 已提交
234 235
}

P
Phillip Webb 已提交
236 237
project("spring-aop") {
	description = "Spring AOP"
238

239
	dependencies {
240 241 242
		compile(project(":spring-core"))
		compile(files(project(":spring-core").cglibRepackJar))
		compile(project(":spring-beans"))
243
		compile("aopalliance:aopalliance:1.0")
244 245 246
		optional("com.jamonapi:jamon:2.4")
		optional("commons-pool:commons-pool:1.5.3")
		optional("org.aspectj:aspectjweaver:${aspectjVersion}")
247
	}
C
Chris Beams 已提交
248 249
}

P
Phillip Webb 已提交
250 251
project("spring-expression") {
	description = "Spring Expression Language (SpEL)"
252

253
	dependencies {
254
		compile(project(":spring-core"))
255
	}
C
Chris Beams 已提交
256 257
}

P
Phillip Webb 已提交
258 259
project("spring-instrument") {
	description = "Spring Instrument"
260

261
	dependencies {
262
		compile(project(":spring-core"))
263
	}
264

265
	jar {
P
Phillip Webb 已提交
266 267
		manifest.attributes["Premain-Class"] =
			"org.springframework.instrument.InstrumentationSavingAgent"
268
	}
C
Chris Beams 已提交
269 270
}

P
Phillip Webb 已提交
271 272
project("spring-instrument-tomcat") {
	description = "Spring Instrument Tomcat"
273

274
	dependencies {
275
		provided("org.apache.tomcat:catalina:6.0.16")
276
	}
C
Chris Beams 已提交
277 278
}

P
Phillip Webb 已提交
279 280
project("spring-context") {
	description = "Spring Context"
281

282
	dependencies {
283
		optional(project(":spring-instrument"))
284 285 286 287 288
		compile(project(":spring-aop"))
		compile(project(":spring-beans"))
		compile(project(":spring-expression"))
		compile(project(":spring-core"))
		compile(files(project(":spring-core").cglibRepackJar))
289 290
		optional("javax.ejb:ejb-api:3.0")
		optional("javax.inject:javax.inject:1")
291
		optional("javax.enterprise.concurrent:javax.enterprise.concurrent-api:1.0-b06")
292
		optional("org.apache.geronimo.specs:geronimo-jms_1.1_spec:1.1")
293
		optional("org.eclipse.persistence:javax.persistence:2.0.0")
294
		optional("org.beanshell:bsh:2.0b4")
295 296
		optional("org.codehaus.groovy:groovy-all:1.8.9")
		optional("org.jruby:jruby:1.7.2")
297
		optional("joda-time:joda-time:2.2")
298
		optional("org.slf4j:slf4j-api:${slf4jVersion}")
299
		optional("javax.validation:validation-api:1.0.0.GA")
300
		optional("org.hibernate:hibernate-validator:4.3.0.Final")
301 302
		optional("org.aspectj:aspectjweaver:${aspectjVersion}")
		optional("org.apache.geronimo.specs:geronimo-jta_1.1_spec:1.1")
303
		testCompile("commons-dbcp:commons-dbcp:1.2.2")
304
		testCompile("javax.inject:javax.inject-tck:1")
305 306 307
	}

	test {
P
Phillip Webb 已提交
308
		jvmArgs = ["-disableassertions:org.aspectj.weaver.UnresolvedType"] // SPR-7989
309
	}
C
Chris Beams 已提交
310 311
}

P
Phillip Webb 已提交
312 313
project("spring-tx") {
	description = "Spring Transaction"
314

315
	dependencies {
316 317
		optional(project(":spring-context")) // for JCA, @EnableTransactionManagement
		optional(project(":spring-aop"))
318 319
		compile(project(":spring-beans"))
		compile(project(":spring-core"))
320
		compile("aopalliance:aopalliance:1.0")
321 322
		provided("com.ibm.websphere:uow:6.0.2.17")
		optional("javax.resource:connector-api:1.5")
323
		optional("javax.transaction:javax.transaction-api:1.2-b03")
324
		optional("javax.ejb:ejb-api:3.0")
325
		testCompile("org.eclipse.persistence:javax.persistence:2.0.0")
326
		testCompile("org.aspectj:aspectjweaver:${aspectjVersion}")
327
	}
C
Chris Beams 已提交
328 329
}

P
Phillip Webb 已提交
330 331 332
project("spring-oxm") {
	description = "Spring Object/XML Marshalling"
	apply from: "oxm.gradle"
333 334 335 336 337 338 339 340

	compileTestJava {
		// necessary to avoid java.lang.VerifyError on jibx compilation
		// see http://jira.codehaus.org/browse/JIBX-465
		sourceCompatibility=1.6
		targetCompatibility=1.6
	}

341
	dependencies {
342 343
		compile(project(":spring-beans"))
		compile(project(":spring-core"))
344
		testCompile(project(":spring-context"))
345 346 347
		optional("com.thoughtworks.xstream:xstream:1.4.4")
		optional("org.jibx:jibx-run:1.2.5")
		optional("org.apache.xmlbeans:xmlbeans:2.6.0")
348
		optional("org.codehaus.castor:castor-xml:1.3.2")
349
		testCompile("org.codehaus.jettison:jettison:1.0.1")
P
Phillip Webb 已提交
350
		testCompile("xmlunit:xmlunit:1.3")
351
		testCompile("xmlpull:xmlpull:1.1.3.4a")
352 353 354 355
		testCompile(files(genCastor.classesDir).builtBy(genCastor))
		testCompile(files(genJaxb.classesDir).builtBy(genJaxb))
		testCompile(files(genXmlbeans.classesDir).builtBy(genXmlbeans))
	}
C
Chris Beams 已提交
356 357
}

P
Phillip Webb 已提交
358 359
project("spring-jms") {
	description = "Spring JMS"
360

361
	dependencies {
362 363 364 365 366
		compile(project(":spring-core"))
		compile(project(":spring-beans"))
		compile(project(":spring-aop"))
		compile(project(":spring-context"))
		compile(project(":spring-tx"))
367
		optional(project(":spring-oxm"))
368
		compile("aopalliance:aopalliance:1.0")
369 370 371
		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")
372 373
		optional("org.codehaus.jackson:jackson-mapper-asl:1.9.12")
		optional("com.fasterxml.jackson.core:jackson-databind:2.2.0")
374
	}
C
Chris Beams 已提交
375 376
}

P
Phillip Webb 已提交
377 378
project("spring-jdbc") {
	description = "Spring JDBC"
379

380
	dependencies {
381 382
		compile(project(":spring-core"))
		compile(project(":spring-beans"))
383
		optional(project(":spring-context")) // for JndiDataSourceLookup
384
		compile(project(":spring-tx"))
385 386 387 388 389 390
		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")
391
	}
C
Chris Beams 已提交
392 393
}

P
Phillip Webb 已提交
394 395
project("spring-context-support") {
	description = "Spring Context Support"
396

397
	dependencies {
398 399 400
		compile(project(":spring-core"))
		compile(project(":spring-beans"))
		compile(project(":spring-context"))
401 402
		optional(project(":spring-jdbc")) // for Quartz support
		optional(project(":spring-tx")) // for Quartz support
403 404 405 406
		optional("javax.mail:mail:1.4.7")
		optional("javax.cache:cache-api:0.6")
		optional("net.sf.ehcache:ehcache-core:2.6.5")
		optional("org.quartz-scheduler:quartz:1.8.6") {
407 408
			exclude group: "org.slf4j", module: "slf4j-log4j12"
		}
409
		optional("org.codehaus.fabric3.api:commonj:1.1.0")
410
		optional("org.apache.velocity:velocity:1.7")
411
		optional("org.freemarker:freemarker:2.3.19")
412
		optional("com.lowagie:itext:2.1.7")
413
		optional("net.sf.jasperreports:jasperreports:5.1.0")
414 415
		optional("org.slf4j:slf4j-api:${slf4jVersion}")
		provided("javax.activation:activation:1.1")
416
		testCompile("org.apache.poi:poi:3.9")
417 418
		testCompile("commons-beanutils:commons-beanutils:1.8.0") // for Velocity/JasperReports
		testCompile("commons-digester:commons-digester:1.8.1") // for Velocity/JasperReports
419
		testCompile("hsqldb:hsqldb:${hsqldbVersion}")
420 421 422
	}

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

P
Phillip Webb 已提交
426 427
project("spring-web") {
	description = "Spring Web"
428
	dependencies {
429 430 431 432
		compile(project(":spring-core"))
		compile(project(":spring-beans")) // for MultiPartFilter
		compile(project(":spring-aop")) // for JaxWsPortProxyFactoryBean
		compile(project(":spring-context"))
433
		optional(project(":spring-oxm")) // for MarshallingHttpMessageConverter
434
		compile("aopalliance:aopalliance:1.0")
435
		provided("javax.el:javax.el-api:2.2.4")
436
		provided("com.sun.faces:jsf-api:2.1.7")
437 438 439 440
		provided("javax.portlet:portlet-api:2.0")
		provided("javax.servlet:javax.servlet-api:3.0.1")
		provided("javax.servlet.jsp:jsp-api:2.1")
		provided("javax.activation:activation:1.1")
441
		optional("com.caucho:hessian:4.0.7")
442
		optional("rome:rome:1.0")
443
		optional("commons-fileupload:commons-fileupload:1.3")
444
		optional("org.apache.httpcomponents:httpclient:4.2")
445 446
		optional("org.codehaus.jackson:jackson-mapper-asl:1.9.12")
		optional("com.fasterxml.jackson.core:jackson-databind:2.2.0")
447 448
		optional("taglibs:standard:1.1.2")
		optional("org.eclipse.jetty:jetty-servlet:8.1.5.v20120716") {
P
Phillip Webb 已提交
449
			exclude group: "org.eclipse.jetty.orbit", module: "javax.servlet"
450
		}
451
		optional("org.eclipse.jetty:jetty-server:8.1.5.v20120716") {
P
Phillip Webb 已提交
452
			exclude group: "org.eclipse.jetty.orbit", module: "javax.servlet"
453
		}
454
		optional("log4j:log4j:1.2.17")
455
		testCompile(project(":spring-context-support"))  // for JafMediaTypeFactory
P
Phillip Webb 已提交
456
		testCompile("xmlunit:xmlunit:1.3")
457 458 459
	}

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

P
Phillip Webb 已提交
463 464
project("spring-orm") {
	description = "Spring Object/Relational Mapping"
465

466 467
	dependencies {
		compile("aopalliance:aopalliance:1.0")
468 469 470 471 472 473
		optional("org.eclipse.persistence:javax.persistence:2.0.0")
		optional("org.eclipse.persistence:org.eclipse.persistence.core:2.4.0")
		optional("org.eclipse.persistence:org.eclipse.persistence.jpa:2.4.0")
		optional("org.hibernate:hibernate-core:3.6.9.Final")
		optional("org.hibernate:hibernate-entitymanager:3.6.9.Final")
		optional("org.apache.openjpa:openjpa:2.2.1")
474
		optional("javax.jdo:jdo-api:3.0")
475
		provided("javax.servlet:javax.servlet-api:3.0.1")
476 477
		testCompile("org.slf4j:slf4j-jcl:${slf4jVersion}")
		testCompile("commons-dbcp:commons-dbcp:1.2.2")
478
		testCompile("hsqldb:hsqldb:${hsqldbVersion}")
479 480
		compile(project(":spring-core"))
		compile(project(":spring-beans"))
481 482
		optional(project(":spring-aop"))
		optional(project(":spring-context"))
483 484
		compile(project(":spring-tx"))
		compile(project(":spring-jdbc"))
485
		optional(project(":spring-web"))
486
	}
C
Chris Beams 已提交
487 488
}

P
Phillip Webb 已提交
489 490
project("spring-orm-hibernate4") {
	description = "Spring Object/Relational Mapping - Hibernate 4 support"
491
	merge.into = project(":spring-orm")
492

493
	dependencies {
494 495
		provided(project(":spring-tx"))
		provided(project(":spring-jdbc"))
496 497
		optional("org.hibernate:hibernate-core:4.2.1.Final")
		optional("org.hibernate:hibernate-entitymanager:4.2.1.Final")
498
		optional(project(":spring-web"))
499
		optional("javax.servlet:javax.servlet-api:3.0.1")
500
	}
501 502
}

R
Rossen Stoyanchev 已提交
503 504 505 506 507 508
project("spring-websocket") {
	description = "Spring WebSocket support"
	dependencies {
		compile(project(":spring-core"))
		compile(project(":spring-context"))
		compile(project(":spring-web"))
509

510 511
		optional("javax.servlet:javax.servlet-api:3.1-b09")
		optional("javax.websocket:javax.websocket-api:1.0-rc5")
512 513 514 515 516 517 518

		optional("org.apache.tomcat:tomcat-websocket:8.0-SNAPSHOT") {
			exclude group: "org.apache.tomcat", module: "tomcat-websocket-api"
			exclude group: "org.apache.tomcat", module: "tomcat-servlet-api"
		}

		optional("org.glassfish.tyrus:tyrus-websocket-core:1.0-SNAPSHOT")
519
		optional("org.glassfish.tyrus:tyrus-container-servlet:1.0-SNAPSHOT")
520

P
Phillip Webb 已提交
521 522 523 524
		optional("org.eclipse.jetty:jetty-webapp:9.0.1.v20130408") {
			exclude group: "org.eclipse.jetty.orbit", module: "javax.servlet"
		}
		optional("org.eclipse.jetty.websocket:websocket-server:9.0.1.v20130408")
R
Rossen Stoyanchev 已提交
525
		optional("org.eclipse.jetty.websocket:websocket-client:9.0.1.v20130408")
P
Phillip Webb 已提交
526

527
		optional("com.fasterxml.jackson.core:jackson-databind:2.0.1") // required for SockJS support currently
528

R
Rossen Stoyanchev 已提交
529 530 531 532
	}

	repositories {
		maven { url "https://maven.java.net/content/groups/public/" } // javax.websocket-*
533 534
		maven { url "https://repository.apache.org/content/repositories/snapshots" } // tomcat-websocket-* snapshots
		maven { url "https://maven.java.net/content/repositories/snapshots" } // tyrus snapshots
R
Rossen Stoyanchev 已提交
535 536 537
	}
}

P
Phillip Webb 已提交
538 539
project("spring-webmvc") {
	description = "Spring Web MVC"
540

541
	dependencies {
542 543 544 545 546
		compile(project(":spring-core"))
		compile(project(":spring-expression"))
		compile(project(":spring-beans"))
		compile(project(":spring-web"))
		compile(project(":spring-context"))
547 548 549 550 551 552 553
		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("net.sourceforge.jexcelapi:jxl:2.6.3")
554
		optional("org.apache.poi:poi:3.9")
555
		optional("com.lowagie:itext:2.1.7")
556
		optional("net.sf.jasperreports:jasperreports:5.1.0") {
557
			exclude group: "xml-apis", module: "xml-apis"
558
		}
559
		optional("rome:rome:1.0")
560 561
		optional("org.apache.velocity:velocity:1.7")
		optional("velocity-tools:velocity-tools-view:1.4")
562 563 564
		optional("org.freemarker:freemarker:2.3.19")
		optional("org.codehaus.jackson:jackson-mapper-asl:1.9.12")
		optional("com.fasterxml.jackson.core:jackson-databind:2.2.0")
565 566 567
		provided("javax.servlet:jstl:1.2")
		provided("javax.servlet:javax.servlet-api:3.0.1")
		provided("javax.servlet.jsp:jsp-api:2.1")
568 569 570
		testCompile(project(":spring-aop"))
		testCompile("org.slf4j:slf4j-jcl:${slf4jVersion}")
		testCompile("rhino:js:1.7R1")
P
Phillip Webb 已提交
571
		testCompile("xmlunit:xmlunit:1.3")
572
		testCompile("dom4j:dom4j:1.6.1") {
P
Phillip Webb 已提交
573
			exclude group: "xml-apis", module: "xml-apis"
574 575
		}
		testCompile("jaxen:jaxen:1.1.1") {
P
Phillip Webb 已提交
576 577 578
			exclude group: "xml-apis", module: "xml-apis"
			exclude group: "xom", module: "xom"
			exclude group: "xerces", module: "xercesImpl"
579
		}
580 581 582 583 584 585 586 587 588 589 590
		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")
591 592 593
	}

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

P
Phillip Webb 已提交
597 598
project("spring-webmvc-tiles3") {
	description = "Spring Framework Tiles3 Integration"
599
	merge.into = project(":spring-webmvc")
600

601
	dependencies {
602 603
		provided(project(":spring-context"))
		provided(project(":spring-web"))
604
		provided("javax.el:javax.el-api:2.2.4")
605 606 607 608 609
		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 已提交
610
			exclude group: "org.slf4j", module: "jcl-over-slf4j"
611
		}
612
		optional("org.apache.tiles:tiles-servlet:3.0.1") {
P
Phillip Webb 已提交
613
			exclude group: "org.slf4j", module: "jcl-over-slf4j"
614
		}
615
		optional("org.apache.tiles:tiles-jsp:3.0.1") {
P
Phillip Webb 已提交
616
			exclude group: "org.slf4j", module: "jcl-over-slf4j"
617 618 619
		}
		optional("org.apache.tiles:tiles-extras:3.0.1") {
			exclude group: "org.slf4j", module: "jcl-over-slf4j"
620
		}
621
		optional("org.apache.tiles:tiles-el:3.0.1") {
P
Phillip Webb 已提交
622
			exclude group: "org.slf4j", module: "jcl-over-slf4j"
623
		}
624 625
		provided("javax.servlet:javax.servlet-api:3.0.1")
		testCompile("org.slf4j:slf4j-jcl:${slf4jVersion}")
626
	}
627 628
}

P
Phillip Webb 已提交
629 630
project("spring-webmvc-portlet") {
	description = "Spring Web Portlet"
631

632
	dependencies {
633
		provided("javax.servlet:javax.servlet-api:3.0.1")
634
		provided("javax.portlet:portlet-api:2.0")
635 636 637 638 639
		compile(project(":spring-core"))
		compile(project(":spring-beans"))
		compile(project(":spring-context"))
		compile(project(":spring-web"))
		compile(project(":spring-webmvc"))
640
		optional("commons-fileupload:commons-fileupload:1.2")
641 642 643
	}

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

P
Phillip Webb 已提交
647 648
project("spring-test") {
	description = "Spring TestContext Framework"
649

650
	dependencies {
651
		compile(project(":spring-core"))
652 653 654 655 656 657 658 659
		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"), )
660 661
		optional("junit:junit:${junitVersion}")
		optional("org.testng:testng:6.5.2")
662
		optional("javax.servlet:javax.servlet-api:3.0.1")
663 664
		optional("javax.servlet.jsp:jsp-api:2.1")
		optional("javax.portlet:portlet-api:2.0")
665
		optional("org.eclipse.persistence:javax.persistence:2.0.0")
666
		optional("org.aspectj:aspectjweaver:${aspectjVersion}")
667
		testCompile("org.hibernate:hibernate-core:3.6.9.Final")
668 669 670 671 672
		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}")
673
	}
674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692

	task testNG(type: Test) {
		useTestNG()
		scanForTestClasses = false
		include "**/testng/*.*"
		exclude "**/FailingBeforeAndAfterMethodsTests.class"
		// "TestCase" classes are run by other test classes, not the build.
		exclude "**/*TestCase.class"
		// Generate TestNG reports alongside JUnit reports.
		testReport true
	}

	test {
		dependsOn testNG
		useJUnit()
		exclude "**/testng/*.*"
		// "TestCase" classes are run by other test classes, not the build.
		exclude(["**/*TestCase.class", "**/*TestSuite.class"])
	}
C
Chris Beams 已提交
693 694
}

P
Phillip Webb 已提交
695 696
project("spring-test-mvc") {
	description = "Spring Test MVC Framework"
697
	merge.into = project(":spring-test")
698

699
	dependencies {
700
		optional(project(":spring-context"))
701
		provided(project(":spring-webmvc"))
702 703 704
		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")
P
Phillip Webb 已提交
705
		optional("xmlunit:xmlunit:1.3")
706
		testCompile("org.slf4j:slf4j-jcl:${slf4jVersion}")
707 708
		testCompile("javax.servlet:jstl:1.2")
		testCompile("org.hibernate:hibernate-validator:4.3.0.Final")
709 710
		testCompile("org.codehaus.jackson:jackson-mapper-asl:1.9.12")
		testCompile("com.fasterxml.jackson.core:jackson-databind:2.2.0")
711
		testCompile(project(":spring-context-support"))
712 713 714
		testCompile(project(":spring-oxm"))
		testCompile("com.thoughtworks.xstream:xstream:1.3.1")
		testCompile("rome:rome:1.0")
715
		testCompile("javax.activation:activation:1.1")
716
		testCompile("javax.mail:mail:1.4.7")
717 718
		testCompile("org.apache.tiles:tiles-request-api:1.0.1")
		testCompile("org.apache.tiles:tiles-api:3.0.1")
719
		testCompile("org.apache.tiles:tiles-core:3.0.1") {
P
Phillip Webb 已提交
720
			exclude group: "org.slf4j", module: "jcl-over-slf4j"
721 722
		}
		testCompile("org.apache.tiles:tiles-servlet:3.0.1") {
P
Phillip Webb 已提交
723
			exclude group: "org.slf4j", module: "jcl-over-slf4j"
724 725
		}
	}
R
Rob Winch 已提交
726 727
}

P
Phillip Webb 已提交
728 729 730
project("spring-aspects") {
	description = "Spring Aspects"
	apply from: "aspects.gradle"
731

732
	dependencies {
733 734 735 736 737 738
		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
739
		aspects(project(":spring-orm"))
740
		provided("org.eclipse.persistence:javax.persistence:2.0.0")
741
		testCompile("javax.mail:mail:1.4.7")
742
		ajc("org.aspectj:aspectjtools:${aspectjVersion}")
C
Chris Beams 已提交
743
		rt("org.aspectj:aspectjrt:${aspectjVersion}")
744 745 746 747
		compile("org.aspectj:aspectjweaver:${aspectjVersion}")
		testCompile(project(":spring-core")) // for CodeStyleAspect
		compile(project(":spring-beans")) // for "p" namespace visibility
		testCompile(project(":spring-test"))
748
	}
749

750
	eclipse.project {
P
Phillip Webb 已提交
751
		natures += "org.eclipse.ajdt.ui.ajnature"
752
		buildCommands = [new org.gradle.plugins.ide.eclipse.model.
P
Phillip Webb 已提交
753
				BuildCommand("org.eclipse.ajdt.core.ajbuilder")]
754
	}
C
Chris Beams 已提交
755 756
}

757
configure(rootProject) {
P
Phillip Webb 已提交
758
	description = "Spring Framework"
759

P
Phillip Webb 已提交
760
	apply plugin: "docbook-reference"
761
	apply plugin: "groovy"
762
	// apply plugin: "detect-split-packages"
763 764 765
	apply from: "${gradleScriptDir}/jdiff.gradle"

	reference {
P
Phillip Webb 已提交
766 767
		sourceDir = file("src/reference/docbook")
		pdfFilename = "spring-framework-reference.pdf"
768 769
	}

770 771 772 773 774
	// TODO: DetectSplitPackagesPlugin fails in line 154 due to method not found on java.io.File.
	// TODO: Possibly related to user rights or OS differences; passes on local Windows machine.
	// detectSplitPackages {
	//	projectsToScan -= project(":spring-instrument-tomcat")
	// }
775

C
Chris Beams 已提交
776
	// don't publish the default jar for the root project
777 778 779
	configurations.archives.artifacts.clear()

	dependencies { // for integration tests
780 781 782 783 784 785 786 787 788 789
		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"))
790
		testCompile(project(":spring-orm"))
791
		testCompile("org.hibernate:hibernate-core:4.2.1.Final")
792
		testCompile("javax.servlet:javax.servlet-api:3.0.1")
793 794 795 796 797
		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}")
798 799 800
	}

	task api(type: Javadoc) {
P
Phillip Webb 已提交
801 802
		group = "Documentation"
		description = "Generates aggregated Javadoc API documentation."
803
		title = "${rootProject.description} ${version} API"
C
Chris Beams 已提交
804

805 806 807 808 809
		dependsOn {
			subprojects.collect {
				it.tasks.getByName("jar")
			}
		}
810 811 812
		options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
		options.author = true
		options.header = rootProject.description
P
Phillip Webb 已提交
813
		options.overview = "src/api/overview.html"
814
		options.stylesheetFile = file("src/api/stylesheet.css")
815
		options.splitIndex = true
C
Chris Beams 已提交
816
		options.links(project.ext.javadocLinks)
817
		options.addStringOption('Xdoclint:none', '-quiet')
C
Chris Beams 已提交
818

819 820 821
		source subprojects.collect { project ->
			project.sourceSets.main.allJava
		}
C
Chris Beams 已提交
822

P
Phillip Webb 已提交
823
		maxMemory = "1024m"
C
Chris Beams 已提交
824
		destinationDir = new File(buildDir, "api")
825 826 827 828 829 830 831 832 833 834 835 836

		doFirst {
			classpath = files(
				// ensure servlet 3.x and Hibernate 4.x have precedence on the Javadoc
				// classpath over their respective 2.5 and 3.x variants
				project(":spring-webmvc").sourceSets.main.compileClasspath.files.find { it =~ "servlet-api" },
				rootProject.sourceSets.test.compileClasspath.files.find { it =~ "hibernate-core" },
				// ensure the javadoc process can resolve types compiled from .aj sources
				project(":spring-aspects").sourceSets.main.output
			)
			classpath += files(subprojects.collect { it.sourceSets.main.compileClasspath })
		}
837 838 839
	}

	task docsZip(type: Zip) {
P
Phillip Webb 已提交
840 841 842
		group = "Distribution"
		baseName = "spring-framework"
		classifier = "docs"
843 844 845
		description = "Builds -${classifier} archive containing api and reference " +
			"for deployment at http://static.springframework.org/spring-framework/docs."

P
Phillip Webb 已提交
846 847
		from("src/dist") {
			include "changelog.txt"
848 849 850
		}

		from (api) {
851
			into "javadoc-api"
852 853 854
		}

		from (reference) {
855
			into "spring-framework-reference"
856 857 858 859
		}
	}

	task schemaZip(type: Zip) {
P
Phillip Webb 已提交
860 861 862
		group = "Distribution"
		baseName = "spring-framework"
		classifier = "schema"
863 864 865 866 867 868 869
		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 已提交
870
				it.path.endsWith("META-INF/spring.schemas")
871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887
			}?.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 已提交
888 889 890
		group = "Distribution"
		baseName = "spring-framework"
		classifier = "dist"
891 892 893 894 895
		description = "Builds -${classifier} archive, containing all jars and docs, " +
					"suitable for community download page."

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

P
Phillip Webb 已提交
896 897 898 899
		from("src/dist") {
			include "readme.txt"
			include "license.txt"
			include "notice.txt"
900
			into "${baseDir}"
P
Phillip Webb 已提交
901
			expand(copyright: new Date().format("yyyy"), version: project.version)
902 903 904 905 906 907 908 909 910 911 912 913 914
		}

		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 已提交
915
				if (subproject.tasks.findByPath("sourcesJar")) {
916 917
					from subproject.sourcesJar
				}
P
Phillip Webb 已提交
918
				if (subproject.tasks.findByPath("javadocJar")) {
919 920 921 922 923 924 925 926 927
					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 已提交
928 929 930
		group = "Distribution"
		baseName = "spring-framework"
		classifier = "dist-with-deps"
931 932 933 934 935 936 937 938 939 940
		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 ->
941 942
					(subproject.configurations.runtime.resolvedConfiguration.resolvedArtifacts +
					subproject.configurations.optional.resolvedConfiguration.resolvedArtifacts).each { artifact ->
943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963
						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 已提交
964 965
		description = "Generates gradlew[.bat] scripts"
		gradleVersion = "1.3"
966 967 968 969

		doLast() {
			def gradleOpts = "-XX:MaxPermSize=1024m -Xmx1024m"
			def gradleBatOpts = "$gradleOpts -XX:MaxHeapSize=256m"
P
Phillip Webb 已提交
970
			File wrapperFile = file("gradlew")
971 972
			wrapperFile.text = wrapperFile.text.replace("DEFAULT_JVM_OPTS=",
				"GRADLE_OPTS=\"$gradleOpts \$GRADLE_OPTS\"\nDEFAULT_JVM_OPTS=")
P
Phillip Webb 已提交
973
			File wrapperBatFile = file("gradlew.bat")
974 975 976 977
			wrapperBatFile.text = wrapperBatFile.text.replace("set DEFAULT_JVM_OPTS=",
				"set GRADLE_OPTS=$gradleBatOpts %GRADLE_OPTS%\nset DEFAULT_JVM_OPTS=")
		}
	}
978

979
}
980 981 982 983 984 985 986 987 988 989 990 991

/*
 * Support publication of artifacts versioned by topic branch.
 * CI builds supply `-P BRANCH_NAME=<TOPIC>` to gradle at build time.
 * If <TOPIC> starts with 'SPR-', change version
 *     from BUILD-SNAPSHOT => <TOPIC>-SNAPSHOT
 *     e.g. 3.2.1.BUILD-SNAPSHOT => 3.2.1.SPR-1234-SNAPSHOT
 */
def qualifyVersionIfNecessary(version) {
	if (rootProject.hasProperty("BRANCH_NAME")) {
		def qualifier = rootProject.getProperty("BRANCH_NAME")
		if (qualifier.startsWith("SPR-")) {
992
			return version.replace('BUILD', qualifier)
993 994
		}
	}
995
	return version
996
}