build.gradle 44.5 KB
Newer Older
1
buildscript {
2
	repositories {
B
Brian Clozel 已提交
3
		maven { url "https://repo.spring.io/plugins-release" }
4 5
	}
	dependencies {
S
Sam Brannen 已提交
6
		classpath("org.springframework.build.gradle:propdeps-plugin:0.0.7")
B
Brian Clozel 已提交
7
		classpath("org.asciidoctor:asciidoctor-gradle-plugin:1.5.2")
8
		classpath("io.spring.gradle:docbook-reference-plugin:0.3.1")
9
		classpath("ws.antonov.gradle.plugins:gradle-plugin-protobuf:0.9.1")
10
	}
11 12
}

13 14 15 16
plugins {
	id "org.sonarqube" version "1.1"
}

S
Stephane Nicoll 已提交
17 18 19 20 21 22
ext {
	linkHomepage = 'https://projects.spring.io/spring-framework'
	linkCi = 'https://build.spring.io/browse/SPR'
	linkIssue = 'https://jira.spring.io/browse/SPR'
	linkScmUrl = 'https://github.com/spring-projects/spring-framework'
	linkScmConnection = 'scm:git:git://github.com/spring-projects/spring-framework.git'
23
	linkScmDevConnection = 'scm:git:ssh://git@github.com:spring-projects/spring-framework.git'
24

25
	moduleProjects = subprojects.findAll {
26 27
		!it.name.equals('spring-build-src') && !it.name.equals('spring-framework-bom')
	}
S
Stephane Nicoll 已提交
28 29
}

C
Chris Beams 已提交
30
configure(allprojects) { project ->
31 32
	group = "org.springframework"
	version = qualifyVersionIfNecessary(version)
33

34
	ext.aspectjVersion       = "1.8.9"
35
	ext.caffeineVersion      = "2.3.1"
36
	ext.eclipselinkVersion   = "2.6.3"
37
	ext.ehcacheVersion       = "2.10.2"
38
	ext.ehcachejcacheVersion = "1.0.1"
39
	ext.ehcache3Version      = "3.1.0"
40
	ext.ejbVersion           = "3.0"
41
	ext.fileuploadVersion    = "1.3.2"
42
	ext.freemarkerVersion    = "2.3.23"
J
Juergen Hoeller 已提交
43
	ext.groovyVersion        = "2.4.7"
44
	ext.gsonVersion          = "2.7"
45
	ext.guavaVersion         = "19.0"
46
	ext.hamcrestVersion      = "1.3"
J
Juergen Hoeller 已提交
47
	ext.hibernate5Version    = "5.2.1.Final"
48
	ext.hibval5Version       = "5.2.4.Final"
49
	ext.hsqldbVersion        = "2.3.4"
50
	ext.httpasyncVersion     = "4.1.2"
51
	ext.httpclientVersion    = "4.5.2"
52
	ext.jackson2Version      = "2.8.0.rc2"
53
	ext.jasperreportsVersion = "6.2.1"  // our tests fail with JR-internal NPEs against 6.2.2 and higher
54
	ext.javamailVersion      = "1.5.5"
55
	ext.jettyVersion         = "9.3.10.v20160621"
56
	ext.jodaVersion          = "2.9.4"
57
	ext.jtaVersion           = "1.2"
J
Juergen Hoeller 已提交
58
	ext.junitVersion         = "4.12"
59 60
	ext.junitJupiterVersion  = '5.0.0-SNAPSHOT'
	ext.junitPlatformVersion = '1.0.0-SNAPSHOT'
61
	ext.nettyVersion         = "4.1.1.Final"
62
	ext.okhttpVersion        = "2.7.5"
63
	ext.okhttp3Version       = "3.3.1"
64
	ext.poiVersion           = "3.14"
R
Rossen Stoyanchev 已提交
65
	ext.reactorVersion       = "2.0.8.RELEASE"
66 67
	ext.romeVersion          = "1.6.0"
	ext.slf4jVersion         = "1.7.21"
68
	ext.snakeyamlVersion     = "1.17"
69
	ext.snifferVersion       = "1.15"
70
	ext.testngVersion        = "6.9.10"
71
	ext.tiles3Version        = "3.0.5"
72
	ext.tomcatVersion        = "8.5.3"
73
	ext.tyrusVersion         = "1.13"
J
Juergen Hoeller 已提交
74
	ext.undertowVersion      = "1.4.0.CR2"
75
	ext.xmlunitVersion       = "1.6"
J
Juergen Hoeller 已提交
76
	ext.xstreamVersion       = "1.4.9"
77

78
	ext.gradleScriptDir = "${rootProject.projectDir}/gradle"
79

80
	apply plugin: "propdeps"
P
Phillip Webb 已提交
81
	apply plugin: "java"
82
	apply plugin: "test-source-set-dependencies"
83
	apply from: "${gradleScriptDir}/ide.gradle"
C
Chris Beams 已提交
84

S
Stephane Nicoll 已提交
85 86 87 88 89
	configurations {
		sniffer
		javaApiSignature
	}

P
Phillip Webb 已提交
90 91 92
	compileJava.options*.compilerArgs = [
		"-Xlint:serial", "-Xlint:varargs", "-Xlint:cast", "-Xlint:classfile",
		"-Xlint:dep-ann", "-Xlint:divzero", "-Xlint:empty", "-Xlint:finally",
S
Stephane Nicoll 已提交
93
		"-Xlint:overrides", "-Xlint:path", "-Xlint:processing", "-Xlint:static",
P
Phillip Webb 已提交
94
		"-Xlint:try", "-Xlint:fallthrough", "-Xlint:rawtypes", "-Xlint:deprecation",
95
		"-Xlint:unchecked", "-Xlint:-options", "-Werror"
96
	]
C
Chris Beams 已提交
97

P
Phillip Webb 已提交
98
	compileTestJava.options*.compilerArgs = [
99
		"-Xlint:serial", "-Xlint:-varargs", "-Xlint:cast", "-Xlint:classfile",
P
Phillip Webb 已提交
100
		"-Xlint:dep-ann", "-Xlint:divzero", "-Xlint:empty", "-Xlint:finally",
S
Stephane Nicoll 已提交
101
		"-Xlint:overrides", "-Xlint:path", "-Xlint:processing", "-Xlint:static",
P
Phillip Webb 已提交
102 103 104
		"-Xlint:try", "-Xlint:-fallthrough", "-Xlint:-rawtypes", "-Xlint:-deprecation",
		"-Xlint:-unchecked", "-Xlint:-options"]

105
	compileJava {
106 107
		sourceCompatibility = 1.8
		targetCompatibility = 1.8
108 109 110
	}

	compileTestJava {
J
Juergen Hoeller 已提交
111 112
		sourceCompatibility = 1.8
		targetCompatibility = 1.8
113
		options.compilerArgs += "-parameters"
J
Juergen Hoeller 已提交
114 115
	}

C
Chris Beams 已提交
116 117
	test {
		systemProperty("java.awt.headless", "true")
118
		systemProperty("testGroups", project.properties.get("testGroups"))
119
		scanForTestClasses = false
120
		include(["**/*Tests.class", "**/*Test.class"])
121 122
		// Since we set scanForTestClasses to false, we need to filter out inner
		// classes with the "$" pattern; otherwise, using -Dtest.single=MyTests to
123
		// run MyTests by itself will fail if MyTests contains any inner classes.
124
		exclude(["**/Abstract*.class", '**/*$*'])
C
Chris Beams 已提交
125
	}
C
Chris Beams 已提交
126

127
	repositories {
B
Brian Clozel 已提交
128
		maven { url "https://repo.spring.io/libs-release" }
129 130
		// For JUnit Platform and Jupiter snapshots:
		maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
131
	}
C
Chris Beams 已提交
132

133
	dependencies {
134 135 136
		testCompile("junit:junit:${junitVersion}") {
			exclude group:'org.hamcrest', module:'hamcrest-core'
		}
137
		testCompile("org.mockito:mockito-core:1.10.19") {
138 139
			exclude group:'org.hamcrest', module:'hamcrest-core'
		}
140
		testCompile("org.hamcrest:hamcrest-all:${hamcrestVersion}")
S
Stephane Nicoll 已提交
141 142

		sniffer("org.codehaus.mojo:animal-sniffer-ant-tasks:${snifferVersion}")
143
		javaApiSignature("org.codehaus.mojo.signature:java18:1.0@signature")
S
Stephane Nicoll 已提交
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
	}

	task copyJavaApiSignature(type: Copy) {
		ext.to = file("$buildDir/javaApiSignature/")
		description "Copy the resolved Animal Sniffer signature dependency artifact to a known location and name"
		from configurations.javaApiSignature
		into to
		rename '.*signature', 'javaApi.signature'
	}

	task sniff {
		group = "Verification"
		description = "Checks the Java API signatures"

		dependsOn compileJava
		dependsOn copyJavaApiSignature

		inputs.dir sourceSets.main.output.classesDir
		inputs.dir copyJavaApiSignature.to
163

S
Stephane Nicoll 已提交
164 165 166 167 168 169 170 171 172 173 174
		doLast {
			ant.taskdef(
				name: 'animalSniffer',
				classname: 'org.codehaus.mojo.animal_sniffer.ant.CheckSignatureTask',
				classpath: configurations.sniffer.asPath
			)

			ant.animalSniffer(
					signature: "$buildDir/javaApiSignature/javaApi.signature",
					classpath: sourceSets.main.compileClasspath.asPath) {
				path(path: sourceSets.main.output.classesDir)
175 176 177
				annotation(className: "org.springframework.lang.UsesJava7")
				annotation(className: "org.springframework.lang.UsesJava8")
				annotation(className: "org.springframework.lang.UsesSunHttpServer")
S
Stephane Nicoll 已提交
178 179
			}
		}
180
	}
C
Chris Beams 已提交
181 182

	ext.javadocLinks = [
183
		"http://docs.oracle.com/javase/8/docs/api/",
184
		"http://docs.oracle.com/javaee/7/api/",
185
		"http://docs.oracle.com/cd/E13222_01/wls/docs90/javadocs/",  // CommonJ
J
Juergen Hoeller 已提交
186 187
		"http://pic.dhe.ibm.com/infocenter/wasinfo/v7r0/topic/com.ibm.websphere.javadoc.doc/web/apidocs/",
		"http://glassfish.java.net/nonav/docs/v3/api/",
P
Phillip Webb 已提交
188 189
		"http://docs.jboss.org/jbossas/javadoc/4.0.5/connector/",
		"http://docs.jboss.org/jbossas/javadoc/7.1.2.Final/",
190
		"http://tiles.apache.org/tiles-request/apidocs/",
J
Juergen Hoeller 已提交
191
		"http://tiles.apache.org/framework/apidocs/",
C
Chris Beams 已提交
192
		"http://www.eclipse.org/aspectj/doc/released/aspectj5rt-api/",
B
Brian Clozel 已提交
193 194
		"http://ehcache.org/apidocs/${ehcacheVersion}",
		"http://ehcache.org/apidocs/${ehcache3Version}",
195
		"http://quartz-scheduler.org/api/2.2.1/",
B
Brian Clozel 已提交
196 197 198
		"http://fasterxml.github.io/jackson-core/javadoc/2.7/",
		"http://fasterxml.github.io/jackson-databind/javadoc/2.7/",
		"http://fasterxml.github.io/jackson-dataformat-xml/javadoc/2.7/",
199
		"http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/"
C
Chris Beams 已提交
200
	] as String[]
201 202
}

203
configure(subprojects - project(":spring-build-src")) { subproject ->
204
	apply plugin: "merge"
205 206
	apply from: "${gradleScriptDir}/publish-maven.gradle"

S
Stephane Nicoll 已提交
207 208 209 210 211
	configurations {
		jacoco
	}

	dependencies {
212
		jacoco("org.jacoco:org.jacoco.agent:0.7.5.201505241946:runtime")
S
Stephane Nicoll 已提交
213 214 215
	}

	gradle.taskGraph.whenReady {taskGraph ->
216
		if (taskGraph.hasTask(':sonarqube')) {
S
Stephane Nicoll 已提交
217 218 219 220
			test.jvmArgs "-javaagent:${configurations.jacoco.asPath}=destfile=${buildDir}/jacoco.exec,includes=org.springframework.*"
		}
	}

221
	jar {
P
Phillip Webb 已提交
222 223 224 225
		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
226 227 228 229 230

		from("${rootProject.projectDir}/src/dist") {
			include "license.txt"
			include "notice.txt"
			into "META-INF"
P
Phillip Webb 已提交
231
			expand(copyright: new Date().format("yyyy"), version: project.version)
232 233 234 235
		}
	}

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

238 239 240
		options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
		options.author = true
		options.header = project.name
C
Chris Beams 已提交
241
		options.links(project.ext.javadocLinks)
242
		options.addStringOption('Xdoclint:none', '-quiet')
C
Chris Beams 已提交
243 244 245 246 247

		// 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
248 249
	}

250 251
	task sourcesJar(type: Jar, dependsOn: classes) {
		classifier = 'sources'
252
		from sourceSets.main.allSource
253
		// don't include or exclude anything explicitly by default. See SPR-12085.
254 255 256
	}

	task javadocJar(type: Jar) {
P
Phillip Webb 已提交
257
		classifier = "javadoc"
258 259 260 261 262 263 264
		from javadoc
	}

	artifacts {
		archives sourcesJar
		archives javadocJar
	}
C
Chris Beams 已提交
265 266
}

267 268
project("spring-build-src") {
	description = "Exposes gradle buildSrc for IDE support"
269
	apply plugin: "groovy"
270 271 272

	dependencies {
		compile gradleApi()
R
Rob Winch 已提交
273
		compile localGroovy()
274 275 276 277 278
	}

	configurations.archives.artifacts.clear()
}

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

282 283
	// As of Spring 4.0.3, spring-core includes asm 5.x and repackages cglib 3.2, inlining
	// both into the spring-core jar. cglib 3.2 itself depends on asm 5.x and is therefore
284
	// further transformed by the JarJar task to depend on org.springframework.asm; this
285
	// avoids including two different copies of asm unnecessarily.
J
Juergen Hoeller 已提交
286
	def cglibVersion = "3.2.4"
287
	def objenesisVersion = "2.4"
288 289 290 291

	configurations {
		jarjar
		cglib
292
		objenesis
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307
	}

	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 已提交
308 309
					rule(pattern: "net.sf.cglib.**", result: "org.springframework.cglib.@1")
					// as mentioned above, transform cglib"s internal asm dependencies from
310 311
					// 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 已提交
312
					rule(pattern: "org.objectweb.asm.**", result: "org.springframework.asm.@1")
313 314 315 316 317
				}
			}
		}
	}

318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336
	task objenesisRepackJar(type: Jar) { repackJar ->
		repackJar.baseName = "spring-objenesis-repack"
		repackJar.version = objenesisVersion

		doLast() {
			project.ant {
				taskdef name: "jarjar", classname: "com.tonicsystems.jarjar.JarJarTask",
					classpath: configurations.jarjar.asPath
				jarjar(destfile: repackJar.archivePath) {
					configurations.objenesis.each { originalJar ->
						zipfileset(src: originalJar)
					}
					// repackage org.objenesis => org.springframework.objenesis
					rule(pattern: "org.objenesis.**", result: "org.springframework.objenesis.@1")
				}
			}
		}
	}

337
	dependencies {
338
		cglib("cglib:cglib:${cglibVersion}@jar")
339
		objenesis("org.objenesis:objenesis:${objenesisVersion}@jar")
340
		jarjar("com.googlecode.jarjar:jarjar:1.3")
341

P
Phillip Webb 已提交
342
		compile(files(cglibRepackJar))
343
		compile(files(objenesisRepackJar))
344
		compile("commons-logging:commons-logging:1.2")
345
		optional("org.aspectj:aspectjweaver:${aspectjVersion}")
346
		optional("net.sf.jopt-simple:jopt-simple:5.0.2")
347
		testCompile("org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}")
348
		testCompile("xmlunit:xmlunit:${xmlunitVersion}")
349
		testCompile("com.fasterxml.woodstox:woodstox-core:5.0.2") {
P
Phillip Webb 已提交
350 351
			exclude group: "stax", module: "stax-api"
		}
352 353 354
	}

	jar {
355
		// inline repackaged cglib classes directly into the spring-core jar
356 357
		dependsOn cglibRepackJar
		from(zipTree(cglibRepackJar.archivePath)) {
P
Phillip Webb 已提交
358
			include "org/springframework/cglib/**"
359
		}
360 361 362 363 364

		dependsOn objenesisRepackJar
		from(zipTree(objenesisRepackJar.archivePath)) {
			include "org/springframework/objenesis/**"
		}
365
	}
C
Chris Beams 已提交
366 367
}

P
Phillip Webb 已提交
368 369
project("spring-beans") {
	description = "Spring Beans"
370

371
	dependencies {
372 373
		compile(project(":spring-core"))
		compile(files(project(":spring-core").cglibRepackJar))
374
		optional("javax.inject:javax.inject:1")
375
		optional("javax.el:javax.el-api:2.2.5")
376
		optional("org.yaml:snakeyaml:${snakeyamlVersion}")
377
		testCompile("org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}")
J
Juergen Hoeller 已提交
378
	}
C
Chris Beams 已提交
379 380
}

381 382
project("spring-beans-groovy") {
	description "Groovy Bean Definitions"
J
Juergen Hoeller 已提交
383
	merge.into = project(":spring-beans")
384
	apply plugin: "groovy"
J
Juergen Hoeller 已提交
385 386 387

	dependencies {
		compile(project(":spring-core"))
388
		optional("org.codehaus.groovy:groovy-all:${groovyVersion}")
J
Juergen Hoeller 已提交
389 390 391 392 393 394 395
	}

	// this module's Java and Groovy sources need to be compiled together
	compileJava.enabled=false
	sourceSets {
		main {
			groovy {
396
				srcDir "src/main/java"
J
Juergen Hoeller 已提交
397 398 399
			}
		}
	}
400 401

	compileGroovy {
402 403
		sourceCompatibility = 1.8
		targetCompatibility = 1.8
404
	}
J
Juergen Hoeller 已提交
405 406
}

P
Phillip Webb 已提交
407 408
project("spring-aop") {
	description = "Spring AOP"
409

410
	dependencies {
411
		compile(project(":spring-beans"))
412 413
		compile(project(":spring-core"))
		compile(files(project(":spring-core").cglibRepackJar))
414
		compile(files(project(":spring-core").objenesisRepackJar))
415
		optional("org.aspectj:aspectjweaver:${aspectjVersion}")
416
		optional("org.apache.commons:commons-pool2:2.4.2")
417
		optional("com.jamonapi:jamon:2.81")
418
	}
C
Chris Beams 已提交
419 420
}

P
Phillip Webb 已提交
421 422
project("spring-expression") {
	description = "Spring Expression Language (SpEL)"
423

424
	dependencies {
425
		compile(project(":spring-core"))
426
	}
C
Chris Beams 已提交
427 428
}

P
Phillip Webb 已提交
429 430
project("spring-instrument") {
	description = "Spring Instrument"
431

432
	jar {
P
Phillip Webb 已提交
433 434
		manifest.attributes["Premain-Class"] =
			"org.springframework.instrument.InstrumentationSavingAgent"
435 436
		manifest.attributes["Agent-Class"] =
			"org.springframework.instrument.InstrumentationSavingAgent"
437 438 439
		manifest.attributes["Can-Redefine-Classes"] = "true"
		manifest.attributes["Can-Retransform-Classes"] = "true"
		manifest.attributes["Can-Set-Native-Method-Prefix"] = "false"
440
	}
C
Chris Beams 已提交
441 442
}

P
Phillip Webb 已提交
443 444
project("spring-context") {
	description = "Spring Context"
445
	apply plugin: "groovy"
446

447
	dependencies {
448 449 450 451 452
		compile(project(":spring-aop"))
		compile(project(":spring-beans"))
		compile(project(":spring-expression"))
		compile(project(":spring-core"))
		compile(files(project(":spring-core").cglibRepackJar))
453
		optional(project(":spring-instrument"))
454
		optional("javax.inject:javax.inject:1")
455
		optional("javax.ejb:ejb-api:${ejbVersion}")
456
		optional("javax.enterprise.concurrent:javax.enterprise.concurrent-api:1.0")
457
		optional("javax.money:money-api:1.0")
458 459 460
		optional("org.eclipse.persistence:javax.persistence:2.1.1")
		optional("javax.validation:validation-api:1.1.0.Final")
		optional("org.hibernate:hibernate-validator:${hibval5Version}")
461 462
		optional("joda-time:joda-time:${jodaVersion}")
		optional("org.aspectj:aspectjweaver:${aspectjVersion}")
J
Juergen Hoeller 已提交
463
		optional("org.codehaus.groovy:groovy-all:${groovyVersion}")
464
		optional("org.beanshell:bsh:2.0b4")
465
		testCompile("javax.inject:javax.inject-tck:1")
466 467
		testCompile("javax.el:javax.el-api:2.2.5")
		testCompile("org.glassfish.web:javax.el:2.2.6")
468
		testCompile("org.javamoney:moneta:1.1")
469
		testCompile("org.apache.commons:commons-pool2:2.4.2")
470
		testCompile("org.slf4j:slf4j-api:${slf4jVersion}")
471
	}
472 473 474 475 476 477 478 479 480
}

project("spring-messaging") {
	description = "Spring Messaging"

	dependencies {
		compile(project(":spring-beans"))
		compile(project(":spring-core"))
		compile(project(":spring-context"))
481
		optional(project(":spring-oxm"))
R
Rossen Stoyanchev 已提交
482
		optional("io.projectreactor:reactor-core:${reactorVersion}")
S
Stephane Maldini 已提交
483
		optional("io.projectreactor:reactor-net:${reactorVersion}") {
484 485
			exclude group: "io.netty", module: "netty-all"
		}
486
		optional("io.netty:netty-all:${nettyVersion}")
B
Brian Clozel 已提交
487
		optional("org.eclipse.jetty.websocket:websocket-server:${jettyVersion}") {
B
Brian Clozel 已提交
488 489
			exclude group: "javax.servlet", module: "javax.servlet-api"
		}
B
Brian Clozel 已提交
490
		optional("org.eclipse.jetty.websocket:websocket-client:${jettyVersion}")
491
		optional("com.fasterxml.jackson.core:jackson-databind:${jackson2Version}")
492
		testCompile("javax.inject:javax.inject-tck:1")
493
		testCompile("javax.servlet:javax.servlet-api:3.1.0")
494
		testCompile("javax.validation:validation-api:1.1.0.Final")
495
		testCompile("com.thoughtworks.xstream:xstream:${xstreamVersion}")
496 497 498 499 500
		testCompile("org.apache.activemq:activemq-broker:5.8.0")
		testCompile("org.apache.activemq:activemq-kahadb-store:5.8.0") {
			exclude group: "org.springframework", module: "spring-context"
		}
		testCompile("org.apache.activemq:activemq-stomp:5.8.0")
B
Brian Clozel 已提交
501
		testCompile("org.eclipse.jetty:jetty-webapp:${jettyVersion}") {
B
Brian Clozel 已提交
502
			exclude group: "javax.servlet", module: "javax.servlet-api"
503
		}
504 505
		testCompile("org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}")
		testCompile("org.apache.tomcat.embed:tomcat-embed-websocket:${tomcatVersion}")
506
		testCompile("io.netty:netty-all:${nettyVersion}")
507
		testCompile("org.slf4j:slf4j-jcl:${slf4jVersion}")
508
		testCompile("xmlunit:xmlunit:${xmlunitVersion}")
509
	}
C
Chris Beams 已提交
510 511
}

P
Phillip Webb 已提交
512 513
project("spring-tx") {
	description = "Spring Transaction"
514

515
	dependencies {
516 517
		compile(project(":spring-beans"))
		compile(project(":spring-core"))
518
		optional(project(":spring-aop"))
519
		optional(project(":spring-context"))  // for JCA, @EnableTransactionManagement
520
		optional("javax.transaction:javax.transaction-api:${jtaVersion}")
521
		optional("javax.resource:connector-api:1.5")
522
		optional("javax.ejb:ejb-api:${ejbVersion}")
523
		optional("com.ibm.websphere:uow:6.0.2.17")
524
		testCompile("org.aspectj:aspectjweaver:${aspectjVersion}")
525
		testCompile("org.eclipse.persistence:javax.persistence:2.1.1")
526
		testCompile("org.codehaus.groovy:groovy-all:${groovyVersion}")
527
	}
C
Chris Beams 已提交
528 529
}

P
Phillip Webb 已提交
530 531 532
project("spring-oxm") {
	description = "Spring Object/XML Marshalling"
	apply from: "oxm.gradle"
533

P
Phillip Webb 已提交
534
	compileTestJava {
535 536
		// necessary to avoid java.lang.VerifyError on jibx compilation
		// see http://jira.codehaus.org/browse/JIBX-465
537 538
		sourceCompatibility = 1.8
		targetCompatibility = 1.8
539 540
	}

541
	dependencies {
542 543
		compile(project(":spring-beans"))
		compile(project(":spring-core"))
544
		optional("org.codehaus.castor:castor-xml:1.4.1")  {
545
			exclude group: 'stax', module: 'stax-api'
546
			exclude group: "org.springframework", module: "spring-context"
547 548 549 550 551
		}
		optional("com.thoughtworks.xstream:xstream:${xstreamVersion}") {
			exclude group: 'xpp3', module: 'xpp3_min'
			exclude group: 'xmlpull', module: 'xmlpull'
		}
552
		optional("org.jibx:jibx-run:1.2.6")
553
		testCompile(project(":spring-context"))
554
		testCompile("xmlunit:xmlunit:${xmlunitVersion}")
555 556
		testCompile("xpp3:xpp3:1.1.4c")
		testCompile("org.codehaus.jettison:jettison:1.3.7") {
557 558
			exclude group: 'stax', module: 'stax-api'
		}
559 560 561 562
		if (compileTestJava.enabled) {
			testCompile(files(genCastor.classesDir).builtBy(genCastor))
			testCompile(files(genJaxb.classesDir).builtBy(genJaxb))
		}
563
	}
C
Chris Beams 已提交
564 565
}

P
Phillip Webb 已提交
566 567
project("spring-jms") {
	description = "Spring JMS"
568

569
	dependencies {
570 571 572 573
		compile(project(":spring-core"))
		compile(project(":spring-beans"))
		compile(project(":spring-aop"))
		compile(project(":spring-context"))
574
		compile(project(":spring-messaging"))
575
		compile(project(":spring-tx"))
576
		provided("javax.jms:jms-api:1.1-rev-1")
577
		optional(project(":spring-oxm"))
578
		optional("javax.transaction:javax.transaction-api:${jtaVersion}")
579
		optional("javax.resource:connector-api:1.5")
580
		optional("com.fasterxml.jackson.core:jackson-databind:${jackson2Version}")
581
	}
C
Chris Beams 已提交
582 583
}

P
Phillip Webb 已提交
584 585
project("spring-jdbc") {
	description = "Spring JDBC"
586

587
	dependencies {
588
		compile(project(":spring-beans"))
589
		compile(project(":spring-core"))
590
		compile(project(":spring-tx"))
591
		optional(project(":spring-context"))  // for JndiDataSourceLookup
592
		optional("javax.transaction:javax.transaction-api:${jtaVersion}")
593
		optional("com.mchange:c3p0:0.9.5.2")
P
Phillip Webb 已提交
594
		optional("org.hsqldb:hsqldb:${hsqldbVersion}")
595
		optional("com.h2database:h2:1.4.192")
596 597
		optional("org.apache.derby:derby:10.12.1.1")
		optional("org.apache.derby:derbyclient:10.12.1.1")
598
	}
C
Chris Beams 已提交
599 600
}

P
Phillip Webb 已提交
601 602
project("spring-context-support") {
	description = "Spring Context Support"
603

604
	dependencies {
605 606 607
		compile(project(":spring-core"))
		compile(project(":spring-beans"))
		compile(project(":spring-context"))
608 609
		optional(project(":spring-jdbc"))  // for Quartz support
		optional(project(":spring-tx"))  // for Quartz support
610
		optional("javax.mail:javax.mail-api:${javamailVersion}")
S
Stephane Nicoll 已提交
611
		optional("javax.cache:cache-api:1.0.0")
612
		optional("com.google.guava:guava:${guavaVersion}")
B
Ben Manes 已提交
613
		optional("com.github.ben-manes.caffeine:caffeine:${caffeineVersion}")
614
		optional("net.sf.ehcache:ehcache:${ehcacheVersion}")
615
		optional("org.quartz-scheduler:quartz:2.2.3")
616
		optional("org.codehaus.fabric3.api:commonj:1.1.0")
617
		optional("org.freemarker:freemarker:${freemarkerVersion}")
618
		optional("com.lowagie:itext:2.1.7")
619
		optional("net.sf.jasperreports:jasperreports:$jasperreportsVersion") {
620 621 622
			exclude group: "com.fasterxml.jackson.core", module: "jackson-annotations"
			exclude group: "com.fasterxml.jackson.core", module: "jackson-core"
			exclude group: "com.fasterxml.jackson.core", module: "jackson-databind"
623 624
			exclude group: "org.olap4j", module: "olap4j"
			exclude group: "xml-apis", module: "xml-apis"
A
Andy Wilkinson 已提交
625
			exclude group: "org.springframework", module: "spring-context"
626
		}
627
		testCompile(project(":spring-context"))
628
		testCompile("org.apache.poi:poi:${poiVersion}")
P
Phillip Webb 已提交
629
		testCompile("org.hsqldb:hsqldb:${hsqldbVersion}")
630
		testCompile("org.slf4j:slf4j-api:${slf4jVersion}")
631
		testRuntime("com.sun.mail:javax.mail:${javamailVersion}")
632
		testRuntime("org.ehcache:jcache:${ehcachejcacheVersion}")
633
	}
C
Chris Beams 已提交
634 635
}

P
Phillip Webb 已提交
636 637
project("spring-web") {
	description = "Spring Web"
638
	apply plugin: "groovy"
639

640 641 642 643 644 645 646 647 648 649 650 651 652 653 654
	// Re-generate Protobuf classes from *.proto files and move them in test sources
	if (project.hasProperty('genProtobuf')) {
		apply plugin: 'protobuf'

		task updateGenProtobuf(type:Copy, dependsOn: ":spring-web:generateTestProto") {
			from "${project.buildDir}/generated-sources/test/"
			into "${projectDir}/src/test/java"
			doLast {
				project.delete "${project.buildDir}/generated-sources/test"
			}
		}

		tasks.getByPath("compileTestJava").dependsOn "updateGenProtobuf"
	}

655
	dependencies {
656 657
		compile(project(":spring-aop"))  // for JaxWsPortProxyFactoryBean
		compile(project(":spring-beans"))  // for MultipartFilter
658
		compile(project(":spring-context"))
659
		compile(project(":spring-core"))
660
		provided("javax.servlet:javax.servlet-api:3.0.1")
661
		optional(project(":spring-oxm"))  // for MarshallingHttpMessageConverter
662
		optional("javax.servlet.jsp:javax.servlet.jsp-api:2.2.1")
663
		optional("javax.el:javax.el-api:2.2.5")
664
		optional("javax.faces:javax.faces-api:2.2")
665
		optional("javax.validation:validation-api:1.1.0.Final")
666
		optional("org.codehaus.groovy:groovy-all:${groovyVersion}")
667
		optional("com.caucho:hessian:4.0.38")
668 669 670
		optional("commons-fileupload:commons-fileupload:${fileuploadVersion}")
		optional("org.apache.httpcomponents:httpclient:${httpclientVersion}")
		optional("org.apache.httpcomponents:httpasyncclient:${httpasyncVersion}")
671
		optional("io.netty:netty-all:${nettyVersion}")
672
		optional("com.squareup.okhttp:okhttp:${okhttpVersion}")
673
		optional("com.squareup.okhttp3:okhttp:${okhttp3Version}")
674
		optional("com.fasterxml.jackson.core:jackson-databind:${jackson2Version}")
675
		optional("com.fasterxml.jackson.dataformat:jackson-dataformat-xml:${jackson2Version}")
R
Roy Clarkson 已提交
676
		optional("com.google.code.gson:gson:${gsonVersion}")
677
		optional("com.rometools:rome:${romeVersion}")
B
Brian Clozel 已提交
678
		optional("org.eclipse.jetty:jetty-servlet:${jettyVersion}") {
B
Brian Clozel 已提交
679
			exclude group: "javax.servlet", module: "javax.servlet-api"
680
		}
B
Brian Clozel 已提交
681
		optional("org.eclipse.jetty:jetty-server:${jettyVersion}") {
B
Brian Clozel 已提交
682
			exclude group: "javax.servlet", module: "javax.servlet-api"
683
		}
684 685
		optional("com.google.protobuf:protobuf-java:2.6.1")
		optional("com.googlecode.protobuf-java-format:protobuf-java-format:1.4")
686
		optional("javax.mail:javax.mail-api:${javamailVersion}")
687
		testCompile(project(":spring-context-support"))  // for JafMediaTypeFactory
688
		testCompile("xmlunit:xmlunit:${xmlunitVersion}")
689
		testCompile("org.slf4j:slf4j-jcl:${slf4jVersion}")
690 691 692
		testCompile("org.apache.taglibs:taglibs-standard-jstlel:1.2.1") {
			exclude group: "org.apache.taglibs", module: "taglibs-standard-spec"
		}
693
		testCompile("com.fasterxml.jackson.datatype:jackson-datatype-joda:${jackson2Version}")
694
		testCompile("com.fasterxml.jackson.datatype:jackson-datatype-jdk8:${jackson2Version}")
695
		testCompile("com.fasterxml.jackson.module:jackson-module-kotlin:${jackson2Version}")
696
		testRuntime("com.sun.mail:javax.mail:${javamailVersion}")
697
	}
C
Chris Beams 已提交
698 699
}

P
Phillip Webb 已提交
700 701
project("spring-orm") {
	description = "Spring Object/Relational Mapping"
702

703
	dependencies {
704 705 706 707 708 709 710
		compile(project(":spring-beans"))
		compile(project(":spring-core"))
		compile(project(":spring-jdbc"))
		compile(project(":spring-tx"))
		optional(project(":spring-aop"))
		optional(project(":spring-context"))
		optional(project(":spring-web"))
711
		optional("org.eclipse.persistence:javax.persistence:2.1.1")
712 713
		optional("org.eclipse.persistence:org.eclipse.persistence.core:${eclipselinkVersion}")
		optional("org.eclipse.persistence:org.eclipse.persistence.jpa:${eclipselinkVersion}") {
714 715
			exclude group: 'org.eclipse.persistence', module: 'javax.persistence'
		}
716
		optional("org.hibernate:hibernate-core:${hibernate5Version}")
717
		optional("javax.servlet:javax.servlet-api:3.0.1")
S
Sam Brannen 已提交
718
		testCompile("org.aspectj:aspectjweaver:${aspectjVersion}")
P
Phillip Webb 已提交
719
		testCompile("org.hsqldb:hsqldb:${hsqldbVersion}")
720
		testCompile("org.slf4j:slf4j-jcl:${slf4jVersion}")
721
	}
C
Chris Beams 已提交
722 723
}

P
Phillip Webb 已提交
724 725
project("spring-webmvc") {
	description = "Spring Web MVC"
726

727
	dependencies {
728
		compile(project(":spring-aop"))
729 730
		compile(project(":spring-beans"))
		compile(project(":spring-context"))
731
		compile(project(":spring-core"))
732
		compile(files(project(":spring-core").objenesisRepackJar))
733 734
		compile(project(":spring-expression"))
		compile(project(":spring-web"))
735
		provided("javax.servlet:javax.servlet-api:3.1.0")
736
		optional(project(":spring-context-support"))  // for FreeMarker support
737
		optional(project(":spring-oxm"))  // for MarshallingView
738 739
		optional("javax.servlet.jsp:javax.servlet.jsp-api:2.2.1")
		optional("javax.servlet.jsp.jstl:javax.servlet.jsp.jstl-api:1.2.1")
740 741
		optional("org.apache.poi:poi:${poiVersion}")
		optional("org.apache.poi:poi-ooxml:${poiVersion}")
742
		optional("org.freemarker:freemarker:${freemarkerVersion}")
743
		optional("org.codehaus.groovy:groovy-all:${groovyVersion}")
744
		optional("com.lowagie:itext:2.1.7")
745
		optional("net.sf.jasperreports:jasperreports:$jasperreportsVersion") {
746 747 748
			exclude group: "com.fasterxml.jackson.core", module: "jackson-annotations"
			exclude group: "com.fasterxml.jackson.core", module: "jackson-core"
			exclude group: "com.fasterxml.jackson.core", module: "jackson-databind"
749 750
			exclude group: "org.olap4j", module: "olap4j"
			exclude group: "xml-apis", module: "xml-apis"
A
Andy Wilkinson 已提交
751
			exclude group: "org.springframework", module: "spring-context"
752 753
		}
		optional("com.fasterxml.jackson.core:jackson-databind:${jackson2Version}")
754
		optional("com.fasterxml.jackson.dataformat:jackson-dataformat-xml:${jackson2Version}")
755
		optional("com.rometools:rome:${romeVersion}")
756 757 758
		optional("javax.el:javax.el-api:2.2.5")
		optional("org.apache.tiles:tiles-api:${tiles3Version}")
		optional("org.apache.tiles:tiles-core:${tiles3Version}") {
759 760
			exclude group: "org.slf4j", module: "jcl-over-slf4j"
		}
761
		optional("org.apache.tiles:tiles-servlet:${tiles3Version}") {
762 763
			exclude group: "org.slf4j", module: "jcl-over-slf4j"
		}
764
		optional("org.apache.tiles:tiles-jsp:${tiles3Version}") {
765 766
			exclude group: "org.slf4j", module: "jcl-over-slf4j"
		}
767
		optional("org.apache.tiles:tiles-el:${tiles3Version}") {
768 769
			exclude group: "org.slf4j", module: "jcl-over-slf4j"
		}
770
		optional("org.apache.tiles:tiles-extras:${tiles3Version}") {
771 772 773
			exclude group: "org.slf4j", module: "jcl-over-slf4j"
			exclude group: "org.springframework", module: "spring-web"
		}
774
		optional('org.webjars:webjars-locator:0.32')
775
		testCompile("xmlunit:xmlunit:${xmlunitVersion}")
776
		testCompile("dom4j:dom4j:1.6.1") {
P
Phillip Webb 已提交
777
			exclude group: "xml-apis", module: "xml-apis"
778 779
		}
		testCompile("jaxen:jaxen:1.1.1") {
P
Phillip Webb 已提交
780 781 782
			exclude group: "xml-apis", module: "xml-apis"
			exclude group: "xom", module: "xom"
			exclude group: "xerces", module: "xercesImpl"
783
		}
B
Brian Clozel 已提交
784
		testCompile("org.eclipse.jetty:jetty-servlet:${jettyVersion}") {
B
Brian Clozel 已提交
785
			exclude group: "javax.servlet", module: "javax.servlet"
786
		}
B
Brian Clozel 已提交
787
		testCompile("org.eclipse.jetty:jetty-server:${jettyVersion}") {
B
Brian Clozel 已提交
788
			exclude group: "javax.servlet", module: "javax.servlet"
789
		}
790 791
		testCompile("javax.validation:validation-api:1.1.0.Final")
		testCompile("org.hibernate:hibernate-validator:${hibval5Version}")
792 793
		testCompile("org.apache.httpcomponents:httpclient:${httpclientVersion}")
		testCompile("commons-fileupload:commons-fileupload:${fileuploadVersion}")
794
		testCompile("commons-io:commons-io:1.3")
795
		testCompile("joda-time:joda-time:${jodaVersion}")
796
		testCompile("org.slf4j:slf4j-jcl:${slf4jVersion}")
797
		testCompile("org.python:jython-standalone:2.5.3")
798
		testCompile("org.mozilla:rhino:1.7.7.1")
799
		testCompile("org.webjars:underscorejs:1.8.3")
800
	}
C
Chris Beams 已提交
801 802
}

803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846
project("spring-websocket") {
	description = "Spring WebSocket"

	dependencies {
		compile(project(":spring-core"))
		compile(project(":spring-context"))
		compile(project(":spring-web"))
		optional(project(":spring-messaging"))
		optional(project(":spring-webmvc"))
		optional("javax.servlet:javax.servlet-api:3.1.0")
		optional("javax.websocket:javax.websocket-api:1.0")
		optional("org.apache.tomcat:tomcat-websocket:${tomcatVersion}") {
			exclude group: "org.apache.tomcat", module: "tomcat-websocket-api"
			exclude group: "org.apache.tomcat", module: "tomcat-servlet-api"
		}
		optional("org.glassfish.tyrus:tyrus-spi:${tyrusVersion}")
		optional("org.glassfish.tyrus:tyrus-core:${tyrusVersion}")
		optional("org.glassfish.tyrus:tyrus-server:${tyrusVersion}")
		optional("org.glassfish.tyrus:tyrus-container-servlet:${tyrusVersion}")
		optional("org.eclipse.jetty:jetty-webapp:${jettyVersion}") {
			exclude group: "javax.servlet", module: "javax.servlet"
		}
		optional("org.eclipse.jetty.websocket:websocket-server:${jettyVersion}") {
			exclude group: "javax.servlet", module: "javax.servlet"
		}
		optional("org.eclipse.jetty.websocket:websocket-client:${jettyVersion}")
		optional("org.eclipse.jetty:jetty-client:${jettyVersion}")
		optional("io.undertow:undertow-core:${undertowVersion}")
		optional("io.undertow:undertow-servlet:${undertowVersion}") {
			exclude group: "org.jboss.spec.javax.servlet", module: "jboss-servlet-api_3.1_spec"
			exclude group: "org.jboss.spec.javax.annotation", module: "jboss-annotations-api_1.2_spec"
		}
		optional("io.undertow:undertow-websockets-jsr:${undertowVersion}") {
			exclude group: "org.jboss.spec.javax.websocket", module: "jboss-websocket-api_1.1_spec"
		}
		optional("com.fasterxml.jackson.core:jackson-databind:${jackson2Version}")
		testCompile("org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}")
		testCompile("org.apache.tomcat.embed:tomcat-embed-websocket:${tomcatVersion}")
		testCompile("io.projectreactor:reactor-net:${reactorVersion}")
		testCompile("io.netty:netty-all:${nettyVersion}")
		testCompile("org.slf4j:slf4j-jcl:${slf4jVersion}")
	}
}

P
Phillip Webb 已提交
847 848
project("spring-test") {
	description = "Spring TestContext Framework"
849

850
	dependencies {
851
		compile(project(":spring-core"))
852 853 854 855 856 857 858
		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"))
859
		optional(project(":spring-websocket"))
860
		optional("junit:junit:${junitVersion}")
861
		optional("org.junit.jupiter:junit-jupiter-api:${junitJupiterVersion}")
862
		optional("org.testng:testng:${testngVersion}")
863
		optional("javax.inject:javax.inject:1")
864
		optional("javax.servlet:javax.servlet-api:3.0.1")
865 866 867 868 869
		optional("javax.servlet.jsp:javax.servlet.jsp-api:2.2.1")
		optional("javax.servlet.jsp.jstl:javax.servlet.jsp.jstl-api:1.2.1")
		optional("org.apache.taglibs:taglibs-standard-jstlel:1.2.1") {
			exclude group: "org.apache.taglibs", module: "taglibs-standard-spec"
		}
870
		optional("javax.el:javax.el-api:2.2.5")
871
		optional("javax.websocket:javax.websocket-api:1.0")
872
		optional("org.aspectj:aspectjweaver:${aspectjVersion}")
S
Sam Brannen 已提交
873
		optional("org.codehaus.groovy:groovy-all:${groovyVersion}")
874
		optional("org.hamcrest:hamcrest-core:${hamcrestVersion}")
875
		optional("xmlunit:xmlunit:${xmlunitVersion}")
876 877 878
		optional("net.sourceforge.htmlunit:htmlunit:2.22")
		optional("org.seleniumhq.selenium:htmlunit-driver:2.21")
		optional("org.seleniumhq.selenium:selenium-java:2.53.1")
879 880
		optional("org.skyscreamer:jsonassert:1.3.0")
		optional("com.jayway.jsonpath:json-path:2.2.0")
881 882
		testCompile(project(":spring-context-support"))
		testCompile(project(":spring-oxm"))
883
		testCompile("javax.mail:javax.mail-api:${javamailVersion}")
884
		testCompile("javax.ejb:ejb-api:${ejbVersion}")
885
		testCompile("org.hibernate:hibernate-core:${hibernate5Version}")
886
		testCompile("org.hibernate:hibernate-validator:${hibval5Version}")
887 888
		// Enable use of the JUnitPlatform Runner
		testCompile("org.junit.platform:junit-platform-runner:${junitPlatformVersion}")
889
		testCompile("com.thoughtworks.xstream:xstream:${xstreamVersion}")
890
		testCompile("com.fasterxml.jackson.core:jackson-databind:${jackson2Version}")
891
		testCompile("com.rometools:rome:${romeVersion}")
892 893
		testCompile("org.apache.tiles:tiles-api:${tiles3Version}")
		testCompile("org.apache.tiles:tiles-core:${tiles3Version}") {
894 895
			exclude group: "org.slf4j", module: "jcl-over-slf4j"
		}
896
		testCompile("org.apache.tiles:tiles-servlet:${tiles3Version}") {
897 898
			exclude group: "org.slf4j", module: "jcl-over-slf4j"
		}
899
		testCompile("org.hsqldb:hsqldb:${hsqldbVersion}")
S
Sam Brannen 已提交
900
		testCompile("org.slf4j:slf4j-jcl:${slf4jVersion}")
901
		testCompile("org.apache.httpcomponents:httpclient:${httpclientVersion}")
902
		testCompile("javax.cache:cache-api:1.0.0")
903 904
		testRuntime("org.junit.jupiter:junit-jupiter-engine:${junitJupiterVersion}")

905
		testRuntime("org.ehcache:ehcache:${ehcache3Version}")
J
Juergen Hoeller 已提交
906
		testRuntime("org.terracotta:management-model:2.0.0")
907
	}
908 909

	task testNG(type: Test) {
910
		description = 'Runs TestNG tests.'
911
		useTestNG()
912
		scanForTestClasses = false
913 914
		include(["**/testng/**/*Tests.class", "**/testng/**/*Test.class"])
		// Show STD_OUT & STD_ERR of the test JVM(s) on the console:
915
		// testLogging.showStandardStreams = true
916
		// forkEvery 1
917 918 919
	}

	test {
920
		description = 'Runs JUnit tests.'
921 922
		dependsOn testNG
		useJUnit()
923 924 925
		scanForTestClasses = false
		include(['**/*Tests.class', '**/*Test.class', '**/SpringJUnitJupiterTestSuite.class'])
		exclude(['**/testng/**/*.*'])
926
	}
927 928

	task aggregateTestReports(type: TestReport) {
929
		description = 'Aggregates JUnit and TestNG test reports.'
930 931 932 933 934
		destinationDir = test.reports.html.destination
		reportOn test, testNG
	}

	check.dependsOn aggregateTestReports
C
Chris Beams 已提交
935 936
}

P
Phillip Webb 已提交
937 938 939
project("spring-aspects") {
	description = "Spring Aspects"
	apply from: "aspects.gradle"
940

941
	dependencies {
942
		aspects(project(":spring-orm"))
943 944 945
		ajc("org.aspectj:aspectjtools:${aspectjVersion}")
		rt("org.aspectj:aspectjrt:${aspectjVersion}")
		compile("org.aspectj:aspectjweaver:${aspectjVersion}")
946
		provided("org.eclipse.persistence:javax.persistence:2.1.1")
947 948 949 950 951 952
		optional(project(":spring-aop"))  // for @Async support
		optional(project(":spring-beans"))  // for @Configurable support
		optional(project(":spring-context"))  // for @Enable* support
		optional(project(":spring-context-support"))  // for JavaMail and JSR-107 support
		optional(project(":spring-orm"))  // for JPA exception translation support
		optional(project(":spring-tx"))  // for JPA, @Transactional support
953
		optional("javax.transaction:javax.transaction-api:${jtaVersion}")  // for @javax.transaction.Transactional support
S
Stephane Nicoll 已提交
954
		optional("javax.cache:cache-api:1.0.0")
955
		testCompile(project(":spring-core"))  // for CodeStyleAspect
956
		testCompile(project(":spring-test"))
957
		testCompile("javax.mail:javax.mail-api:${javamailVersion}")
958
	}
959

960
	eclipse.project {
P
Phillip Webb 已提交
961
		natures += "org.eclipse.ajdt.ui.ajnature"
962
		buildCommands = [new org.gradle.plugins.ide.eclipse.model.BuildCommand("org.eclipse.ajdt.core.ajbuilder")]
963
	}
C
Chris Beams 已提交
964 965
}

966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000
project("spring-framework-bom") {
	description = "Spring Framework (Bill of Materials)"

	configurations.archives.artifacts.clear()
	artifacts {
		// work around GRADLE-2406 by attaching text artifact
		archives(file("spring-framework-bom.txt"))
	}

	install {
		repositories.mavenInstaller {
			pom.whenConfigured {
				packaging = "pom"
				withXml {
					asNode().children().last() + {
						delegate.dependencyManagement {
							delegate.dependencies {
								parent.subprojects.sort { "$it.name" }.each { p ->
									if (p.hasProperty("merge") && p.merge.into == null && p != project) {
										delegate.dependency {
											delegate.groupId(p.group)
											delegate.artifactId(p.name)
											delegate.version(p.version)
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}
}

1001 1002
sonarqube {
	properties {
S
Stephane Nicoll 已提交
1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014
		property "sonar.projectName", "Spring Framework"
		property "sonar.profile", "Spring Framework"
		property "sonar.jacoco.reportPath", "${buildDir.name}/jacoco.exec"
		property "sonar.links.homepage", linkHomepage
		property "sonar.links.ci", linkCi
		property "sonar.links.issue", linkIssue
		property "sonar.links.scm", linkScmUrl
		property "sonar.links.scm_dev", linkScmDevConnection
		property "sonar.java.coveragePlugin", "jacoco"
	}
}

1015
configure(rootProject) {
P
Phillip Webb 已提交
1016
	description = "Spring Framework"
1017

B
Brian Clozel 已提交
1018
	apply plugin: "org.asciidoctor.convert"
1019
	apply plugin: "docbook-reference"
1020
	apply plugin: "groovy"
R
Rob Winch 已提交
1021

1022
	// apply plugin: "detect-split-packages"
1023 1024
	apply from: "${gradleScriptDir}/jdiff.gradle"

R
Rob Winch 已提交
1025
	asciidoctor {
B
Brian Clozel 已提交
1026 1027
		sourceDir project.file('src/asciidoc')
		separateOutputDirs = false
1028
		backends = ['docbook']
B
Brian Clozel 已提交
1029
		options doctype: 'book', eruby: 'erubis'
J
Juergen Hoeller 已提交
1030
		attributes 'spring-version': project.version, 'revnumber': project.version, 'docinfo': ""
1031 1032
	}

1033 1034 1035
	reference {
		sourceDir = asciidoctor.outputDir
		pdfFilename = "spring-framework-reference.pdf"
1036
		epubFilename = "spring-framework-reference.epub"
1037 1038 1039 1040 1041 1042 1043
		expandPlaceholders = ""
	}

	afterEvaluate {
		tasks.findAll { it.name.startsWith("reference") }.each{ it.dependsOn.add("asciidoctor") }
	}

1044 1045 1046 1047 1048
	// 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")
	// }
1049

C
Chris Beams 已提交
1050
	// don't publish the default jar for the root project
1051 1052
	configurations.archives.artifacts.clear()

1053
	dependencies {  // for integration tests
1054
		testCompile(project(":spring-aop"))
1055
		testCompile(project(":spring-beans"))
1056
		testCompile(project(":spring-context"))
1057 1058
		testCompile(project(":spring-core"))
		testCompile(project(":spring-expression"))
1059
		testCompile(project(":spring-jdbc"))
1060
		testCompile(project(":spring-orm"))
1061
		testCompile(project(":spring-test"))
1062
		testCompile(project(":spring-tx"))
1063
		testCompile(project(":spring-web"))
1064
		testCompile("javax.servlet:javax.servlet-api:3.0.1")
1065 1066 1067
		testCompile("javax.inject:javax.inject:1")
		testCompile("javax.resource:connector-api:1.5")
		testCompile("org.aspectj:aspectjweaver:${aspectjVersion}")
1068
		testCompile("org.hibernate:hibernate-core:${hibernate5Version}")
P
Phillip Webb 已提交
1069
		testCompile("org.hsqldb:hsqldb:${hsqldbVersion}")
1070 1071 1072
	}

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

1077 1078 1079 1080 1081
		dependsOn {
			subprojects.collect {
				it.tasks.getByName("jar")
			}
		}
1082 1083 1084
		options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
		options.author = true
		options.header = rootProject.description
P
Phillip Webb 已提交
1085
		options.overview = "src/api/overview.html"
1086
		options.stylesheetFile = file("src/api/stylesheet.css")
1087
		options.splitIndex = true
C
Chris Beams 已提交
1088
		options.links(project.ext.javadocLinks)
1089
		options.addStringOption('Xdoclint:none', '-quiet')
C
Chris Beams 已提交
1090

1091 1092 1093
		source subprojects.collect { project ->
			project.sourceSets.main.allJava
		}
C
Chris Beams 已提交
1094

P
Phillip Webb 已提交
1095
		maxMemory = "1024m"
C
Chris Beams 已提交
1096
		destinationDir = new File(buildDir, "api")
1097 1098 1099

		doFirst {
			classpath = files(
1100 1101
                // ensure Servlet 3.x has precedence on the javadoc classpath
                project(":spring-webmvc").sourceSets.main.compileClasspath.files.find { it =~ "servlet-api" },
1102 1103 1104 1105 1106
				// 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 })
		}
1107 1108
	}

1109
	task docsZip(type: Zip, dependsOn: 'reference') {
P
Phillip Webb 已提交
1110 1111 1112
		group = "Distribution"
		baseName = "spring-framework"
		classifier = "docs"
1113 1114 1115
		description = "Builds -${classifier} archive containing api and reference " +
			"for deployment at http://static.springframework.org/spring-framework/docs."

P
Phillip Webb 已提交
1116 1117
		from("src/dist") {
			include "changelog.txt"
1118 1119 1120
		}

		from (api) {
1121
			into "javadoc-api"
1122 1123
		}

1124 1125
		from (reference) {
			into "spring-framework-reference"
1126 1127 1128 1129
		}
	}

	task schemaZip(type: Zip) {
P
Phillip Webb 已提交
1130 1131 1132
		group = "Distribution"
		baseName = "spring-framework"
		classifier = "schema"
1133 1134
		description = "Builds -${classifier} archive containing all " +
			"XSDs for deployment at http://springframework.org/schema."
S
Stephane Nicoll 已提交
1135
		duplicatesStrategy 'exclude'
1136
		moduleProjects.each { subproject ->
1137 1138 1139
			def Properties schemas = new Properties();

			subproject.sourceSets.main.resources.find {
P
Phillip Webb 已提交
1140
				it.path.endsWith("META-INF/spring.schemas")
1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157
			}?.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 已提交
1158 1159 1160
		group = "Distribution"
		baseName = "spring-framework"
		classifier = "dist"
1161
		description = "Builds -${classifier} archive, containing all jars and docs, " +
J
Juergen Hoeller 已提交
1162
			"suitable for community download page."
1163 1164 1165

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

P
Phillip Webb 已提交
1166 1167 1168 1169
		from("src/dist") {
			include "readme.txt"
			include "license.txt"
			include "notice.txt"
1170
			into "${baseDir}"
P
Phillip Webb 已提交
1171
			expand(copyright: new Date().format("yyyy"), version: project.version)
1172 1173 1174 1175 1176 1177 1178 1179 1180 1181
		}

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

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

1182
		moduleProjects.each { subproject ->
1183 1184
			into ("${baseDir}/libs") {
				from subproject.jar
P
Phillip Webb 已提交
1185
				if (subproject.tasks.findByPath("sourcesJar")) {
1186 1187
					from subproject.sourcesJar
				}
P
Phillip Webb 已提交
1188
				if (subproject.tasks.findByPath("javadocJar")) {
1189 1190 1191 1192 1193 1194
					from subproject.javadocJar
				}
			}
		}
	}

1195
	// Create a distribution that contains all dependencies (required and optional).
1196 1197
	// Not published by default; only for use when building from source.
	task depsZip(type: Zip, dependsOn: distZip) { zipTask ->
P
Phillip Webb 已提交
1198 1199 1200
		group = "Distribution"
		baseName = "spring-framework"
		classifier = "dist-with-deps"
1201 1202 1203 1204 1205 1206 1207 1208 1209 1210
		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 ->
1211 1212
					(subproject.configurations.runtime.resolvedConfiguration.resolvedArtifacts +
					subproject.configurations.optional.resolvedConfiguration.resolvedArtifacts).each { artifact ->
1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233
						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 已提交
1234
		description = "Generates gradlew[.bat] scripts"
S
Sam Brannen 已提交
1235
		gradleVersion = "2.14"
1236 1237

		doLast() {
1238
			def gradleOpts = "-XX:MaxMetaspaceSize=1024m -Xmx1024m"
1239
			def gradleBatOpts = "$gradleOpts -XX:MaxHeapSize=256m"
P
Phillip Webb 已提交
1240
			File wrapperFile = file("gradlew")
1241 1242
			wrapperFile.text = wrapperFile.text.replace("DEFAULT_JVM_OPTS=",
				"GRADLE_OPTS=\"$gradleOpts \$GRADLE_OPTS\"\nDEFAULT_JVM_OPTS=")
P
Phillip Webb 已提交
1243
			File wrapperBatFile = file("gradlew.bat")
1244 1245 1246 1247
			wrapperBatFile.text = wrapperBatFile.text.replace("set DEFAULT_JVM_OPTS=",
				"set GRADLE_OPTS=$gradleBatOpts %GRADLE_OPTS%\nset DEFAULT_JVM_OPTS=")
		}
	}
1248

1249
}
1250

S
Stephane Nicoll 已提交
1251
configure([project(':spring-build-src'), project(':spring-framework-bom')]) {
1252
	sonarqube {
S
Stephane Nicoll 已提交
1253 1254 1255 1256 1257
		skipProject = true
	}
}

configure(project(':spring-core')) {
1258 1259
	sonarqube {
		properties {
S
Stephane Nicoll 已提交
1260 1261 1262 1263 1264 1265
			property "sonar.exclusions",
					"src/main/java/org/springframework/cglib/**/*,src/main/java/org/springframework/asm/**/*"
		}
	}
}

1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276
/*
 * 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-")) {
1277
			return version.replace('BUILD', qualifier)
1278 1279
		}
	}
1280
	return version
1281
}