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

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

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

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

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

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

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

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

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

41
	dependencies {
42
		testCompile("junit:junit:${junitVersion}")
43 44
		testCompile("org.hamcrest:hamcrest-all:1.3")
		testCompile("org.easymock:easymock:${easymockVersion}")
45
	}
46 47
}

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

	jar {
P
Phillip Webb 已提交
53 54 55 56
		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
57 58 59 60 61

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

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

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

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

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


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

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

	configurations {
		jarjar
		asm
		cglib
	}

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

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

	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 已提交
140 141
					rule(pattern: "net.sf.cglib.**", result: "org.springframework.cglib.@1")
					// as mentioned above, transform cglib"s internal asm dependencies from
142 143
					// 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 已提交
144
					rule(pattern: "org.objectweb.asm.**", result: "org.springframework.asm.@1")
145 146 147 148 149 150
				}
			}
		}
	}

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

156 157
		compile(files(asmRepackJar))
		compile("commons-logging:commons-logging:1.1.1")
158
		optional("org.aspectj:aspectjweaver:${aspectjVersion}")
159
		optional("net.sf.jopt-simple:jopt-simple:3.0")
160
		optional("log4j:log4j:1.2.17")
161 162
		testCompile("xmlunit:xmlunit:1.2")
		testCompile("org.codehaus.woodstox:wstx-asl:3.2.7")
163 164 165 166 167 168
	}

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

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

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

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

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

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

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

	test {
P
Phillip Webb 已提交
255
		jvmArgs = ["-disableassertions:org.aspectj.weaver.UnresolvedType"] // SPR-7989
256
	}
C
Chris Beams 已提交
257 258
}

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

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

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

P
Phillip Webb 已提交
316 317
project("spring-jdbc") {
	description = "Spring JDBC"
318
	dependencies {
319 320
		compile(project(":spring-core"))
		compile(project(":spring-beans"))
321
		optional(project(":spring-context")) // for JndiDataSourceLookup
322
		compile(project(":spring-tx"))
323 324 325 326 327 328
		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")
329
	}
C
Chris Beams 已提交
330 331
}

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

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

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

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

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

P
Phillip Webb 已提交
434 435
project("spring-orm-hibernate4") {
	description = "Spring Object/Relational Mapping - Hibernate 4 support"
436
	merge.into = project(":spring-orm")
437
	dependencies {
438 439
		compile(project(":spring-tx"))
		compile(project(":spring-jdbc"))
440 441
		optional("org.hibernate:hibernate-core:4.1.0.Final")
		optional("org.hibernate:hibernate-entitymanager:4.1.0.Final")
442
		optional(project(":spring-web"))
443
		optional("javax.servlet:servlet-api:2.5")
444
	}
445 446
}

P
Phillip Webb 已提交
447 448
project("spring-webmvc") {
	description = "Spring Web MVC"
449
	dependencies {
450 451 452 453 454
		compile(project(":spring-core"))
		compile(project(":spring-expression"))
		compile(project(":spring-beans"))
		compile(project(":spring-web"))
		compile(project(":spring-context"))
455 456 457 458 459 460 461 462 463 464 465 466
		optional(project(":spring-context-support")) // for Velocity support
		optional(project(":spring-oxm")) // for MarshallingView
		optional("org.apache.tiles:tiles-api:2.1.2")
		optional("org.apache.tiles:tiles-core:2.1.2")
		optional("org.apache.tiles:tiles-jsp:2.1.2")
		optional("org.apache.tiles:tiles-servlet:2.1.2")
		optional("velocity-tools:velocity-tools-view:1.4")
		optional("net.sourceforge.jexcelapi:jxl:2.6.3")
		optional("org.apache.poi:poi:3.0.2-FINAL")
		optional("com.lowagie:itext:2.1.7")
		optional("jasperreports:jasperreports:2.0.5") {
			exclude group: "xml-apis", module: "xml-apis"
467
		}
468 469 470 471 472 473 474 475
		optional("rome:rome:1.0")
		optional("velocity:velocity:1.5")
		optional("org.freemarker:freemarker:2.3.15")
		optional("org.codehaus.jackson:jackson-mapper-asl:1.4.2")
		optional("com.fasterxml.jackson.core:jackson-databind:2.0.1")
		provided("javax.servlet:jstl:1.2")
		provided("javax.servlet:javax.servlet-api:3.0.1")
		provided("javax.servlet.jsp:jsp-api:2.1")
476 477 478 479
		testCompile(project(":spring-aop"))
		testCompile("org.slf4j:slf4j-jcl:${slf4jVersion}")
		testCompile("rhino:js:1.7R1")
		testCompile("xmlunit:xmlunit:1.2")
480
		testCompile("dom4j:dom4j:1.6.1") {
P
Phillip Webb 已提交
481
			exclude group: "xml-apis", module: "xml-apis"
482 483
		}
		testCompile("jaxen:jaxen:1.1.1") {
P
Phillip Webb 已提交
484 485 486
			exclude group: "xml-apis", module: "xml-apis"
			exclude group: "xom", module: "xom"
			exclude group: "xerces", module: "xercesImpl"
487
		}
488 489 490 491 492 493 494 495 496 497 498
		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")
499
		testCompile(project(":spring-web").sourceSets.test.output)
500 501 502
	}

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

P
Phillip Webb 已提交
506 507
project("spring-webmvc-tiles3") {
	description = "Spring Framework Tiles3 Integration"
508
	merge.into = project(":spring-webmvc")
509
	dependencies {
510
		compile(project(":spring-context"))
511 512 513 514 515 516
		provided("javax.el:el-api:1.0")
		provided("javax.servlet:jstl:1.2")
		provided("javax.servlet.jsp:jsp-api:2.1")
		optional("org.apache.tiles:tiles-request-api:1.0.1")
		optional("org.apache.tiles:tiles-api:3.0.1")
		optional("org.apache.tiles:tiles-core:3.0.1") {
P
Phillip Webb 已提交
517
			exclude group: "org.slf4j", module: "jcl-over-slf4j"
518
		}
519
		optional("org.apache.tiles:tiles-servlet:3.0.1") {
P
Phillip Webb 已提交
520
			exclude group: "org.slf4j", module: "jcl-over-slf4j"
521
		}
522
		optional("org.apache.tiles:tiles-jsp:3.0.1") {
P
Phillip Webb 已提交
523
			exclude group: "org.slf4j", module: "jcl-over-slf4j"
524
		}
525
		optional("org.apache.tiles:tiles-el:3.0.1") {
P
Phillip Webb 已提交
526
			exclude group: "org.slf4j", module: "jcl-over-slf4j"
527
		}
528
		provided("javax.servlet:javax.servlet-api:3.0.1")
529
		compile(project(":spring-web").sourceSets*.output) // mock request & response
530
		testCompile("org.slf4j:slf4j-jcl:${slf4jVersion}")
531
	}
532 533
}

P
Phillip Webb 已提交
534 535
project("spring-webmvc-portlet") {
	description = "Spring Web Portlet"
536
	dependencies {
537 538
		provided("javax.servlet:servlet-api:2.5")
		provided("javax.portlet:portlet-api:2.0")
539 540 541 542 543
		compile(project(":spring-core"))
		compile(project(":spring-beans"))
		compile(project(":spring-context"))
		compile(project(":spring-web"))
		compile(project(":spring-webmvc"))
544
		optional("commons-fileupload:commons-fileupload:1.2")
545 546 547
	}

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

P
Phillip Webb 已提交
551 552
project("spring-test") {
	description = "Spring TestContext Framework"
553
	dependencies {
554
		compile(project(":spring-core"))
555 556 557 558 559 560 561 562
		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"), )
563 564
		optional("junit:junit:${junitVersion}")
		optional("org.testng:testng:6.5.2")
565 566 567 568 569 570 571 572 573 574 575
		optional("javax.servlet:servlet-api:2.5")
		optional("javax.servlet.jsp:jsp-api:2.1")
		optional("javax.portlet:portlet-api:2.0")
		optional("javax.persistence:persistence-api:1.0")
		optional("org.aspectj:aspectjweaver:${aspectjVersion}")
		testCompile("org.hibernate:hibernate-core:3.3.2.GA")
		provided("javax.inject:javax.inject:1")
		provided("javax.activation:activation:1.1")
		provided("javax.servlet:jstl:1.2")
		testCompile "org.slf4j:slf4j-jcl:${slf4jVersion}"
		testCompile("hsqldb:hsqldb:${hsqldbVersion}")
576
	}
C
Chris Beams 已提交
577 578
}

P
Phillip Webb 已提交
579 580
project("spring-test-mvc") {
	description = "Spring Test MVC Framework"
581
	merge.into = project(":spring-test")
582
	dependencies {
583
		optional(project(":spring-context"))
584
		compile(project(":spring-webmvc"))
585 586 587 588 589
		provided("javax.servlet:javax.servlet-api:3.0.1")
		optional("org.hamcrest:hamcrest-core:1.3")
		optional("com.jayway.jsonpath:json-path:0.8.1")
		optional("xmlunit:xmlunit:1.2")
		testCompile("org.slf4j:slf4j-jcl:${slf4jVersion}")
590 591 592
		testCompile("javax.servlet:jstl:1.2")
		testCompile("org.hibernate:hibernate-validator:4.3.0.Final")
		testCompile("org.codehaus.jackson:jackson-mapper-asl:1.4.2")
593 594
		testCompile("com.fasterxml.jackson.core:jackson-databind:2.0.1")
		testCompile(project(":spring-context-support"))
595 596 597 598
		testCompile(project(":spring-oxm"))
		testCompile("com.thoughtworks.xstream:xstream:1.3.1")
		testCompile("cglib:cglib-nodep:2.2")
		testCompile("rome:rome:1.0")
599 600
		testCompile("javax.activation:activation:1.1")
		testCompile("javax.mail:mail:1.4")
601 602 603 604
		testCompile("javax.xml.bind:jaxb-api:2.2.6")
		testCompile("org.easymock:easymockclassextension:${easymockVersion}")
		testCompile("org.apache.tiles:tiles-request-api:1.0.1")
		testCompile("org.apache.tiles:tiles-api:3.0.1")
605
		testCompile("org.apache.tiles:tiles-core:3.0.1") {
P
Phillip Webb 已提交
606
			exclude group: "org.slf4j", module: "jcl-over-slf4j"
607 608
		}
		testCompile("org.apache.tiles:tiles-servlet:3.0.1") {
P
Phillip Webb 已提交
609
			exclude group: "org.slf4j", module: "jcl-over-slf4j"
610 611
		}
	}
R
Rob Winch 已提交
612 613
}

P
Phillip Webb 已提交
614 615
project("spring-struts") {
	description = "Spring Struts"
616
	dependencies {
617 618 619 620 621 622 623
		compile(project(":spring-core"))
		compile(project(":spring-beans"))
		compile(project(":spring-context"))
		compile(project(":spring-web"))
		compile(project(":spring-webmvc"))
		compile("struts:struts:1.2.9")
		compile("commons-beanutils:commons-beanutils:1.7.0")
624 625
		provided("javax.servlet:servlet-api:2.5")
		provided("javax.servlet:jstl:1.2")
626
		testCompile(project(":spring-test"))
627
	}
C
Chris Beams 已提交
628 629
}

P
Phillip Webb 已提交
630 631 632
project("spring-aspects") {
	description = "Spring Aspects"
	apply from: "aspects.gradle"
633
	dependencies {
634 635 636 637 638 639
		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
640
		aspects(project(":spring-orm"))
641 642
		provided("javax.persistence:persistence-api:1.0")
		testCompile("javax.mail:mail:1.4")
643 644 645 646 647
		ajc("org.aspectj:aspectjtools:${aspectjVersion}")
		compile("org.aspectj:aspectjweaver:${aspectjVersion}")
		testCompile(project(":spring-core")) // for CodeStyleAspect
		compile(project(":spring-beans")) // for "p" namespace visibility
		testCompile(project(":spring-test"))
648 649
	}
	eclipse.project {
P
Phillip Webb 已提交
650
		natures += "org.eclipse.ajdt.ui.ajnature"
651
		buildCommands = [new org.gradle.plugins.ide.eclipse.model.
P
Phillip Webb 已提交
652
				BuildCommand("org.eclipse.ajdt.core.ajbuilder")]
653
	}
C
Chris Beams 已提交
654 655
}

656
configure(rootProject) {
P
Phillip Webb 已提交
657
	description = "Spring Framework"
658

P
Phillip Webb 已提交
659
	apply plugin: "docbook-reference"
660
	apply plugin: "groovy"
661 662
	apply from: "${gradleScriptDir}/jdiff.gradle"

663
	eclipse.classpath.file.whenMerged { classpath ->
664 665 666 667 668
		def sourceFolder = new org.gradle.plugins.ide.eclipse.model.SourceFolder(
			"buildSrc/src/main/groovy", null)
		if(!classpath.entries.contains(sourceFolder)) {
			classpath.entries.add(0, sourceFolder)
		}
669 670
	}

671
	reference {
P
Phillip Webb 已提交
672 673
		sourceDir = file("src/reference/docbook")
		pdfFilename = "spring-framework-reference.pdf"
674 675
	}

P
Phillip Webb 已提交
676
	// don"t publish the default jar for the root project
677 678 679
	configurations.archives.artifacts.clear()

	dependencies { // for integration tests
680 681
		compile gradleApi()
		groovy localGroovy()
682 683 684 685 686 687 688 689 690 691
		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"))
692
		testCompile(project(":spring-orm"))
693 694
		testCompile("org.hibernate:hibernate-core:4.1.0.Final")
		testCompile("javax.servlet:servlet-api:2.5")
695 696 697 698 699
		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}")
700 701 702
	}

	task api(type: Javadoc) {
P
Phillip Webb 已提交
703 704
		group = "Documentation"
		description = "Generates aggregated Javadoc API documentation."
705 706 707 708
		title = "${rootProject.description} ${version} API"
		options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
		options.author = true
		options.header = rootProject.description
P
Phillip Webb 已提交
709
		options.overview = "src/api/overview.html"
710 711
		options.splitIndex = true
		options.links(
P
Phillip Webb 已提交
712
			"http://docs.jboss.org/jbossas/javadoc/4.0.5/connector"
713 714 715 716 717 718 719 720
		)
		source subprojects.collect { project ->
			project.sourceSets.main.allJava
		}
		destinationDir = new File(buildDir, "api")
		classpath = files(subprojects.collect { project ->
			project.sourceSets.main.compileClasspath
		})
P
Phillip Webb 已提交
721
		maxMemory = "1024m"
722 723 724
	}

	task docsZip(type: Zip) {
P
Phillip Webb 已提交
725 726 727
		group = "Distribution"
		baseName = "spring-framework"
		classifier = "docs"
728 729 730
		description = "Builds -${classifier} archive containing api and reference " +
			"for deployment at http://static.springframework.org/spring-framework/docs."

P
Phillip Webb 已提交
731 732
		from("src/dist") {
			include "changelog.txt"
733 734 735
		}

		from (api) {
736
			into "javadoc-api"
737 738 739
		}

		from (reference) {
740
			into "spring-framework-reference"
741 742 743 744
		}
	}

	task schemaZip(type: Zip) {
P
Phillip Webb 已提交
745 746 747
		group = "Distribution"
		baseName = "spring-framework"
		classifier = "schema"
748 749 750 751 752 753 754
		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 已提交
755
				it.path.endsWith("META-INF/spring.schemas")
756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772
			}?.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 已提交
773 774 775
		group = "Distribution"
		baseName = "spring-framework"
		classifier = "dist"
776 777 778 779 780
		description = "Builds -${classifier} archive, containing all jars and docs, " +
					"suitable for community download page."

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

P
Phillip Webb 已提交
781 782 783 784
		from("src/dist") {
			include "readme.txt"
			include "license.txt"
			include "notice.txt"
785
			into "${baseDir}"
P
Phillip Webb 已提交
786
			expand(copyright: new Date().format("yyyy"), version: project.version)
787 788 789 790 791 792 793 794 795 796 797 798 799
		}

		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 已提交
800
				if (subproject.tasks.findByPath("sourcesJar")) {
801 802
					from subproject.sourcesJar
				}
P
Phillip Webb 已提交
803
				if (subproject.tasks.findByPath("javadocJar")) {
804 805 806 807 808 809 810 811 812
					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 已提交
813 814 815
		group = "Distribution"
		baseName = "spring-framework"
		classifier = "dist-with-deps"
816 817 818 819 820 821 822 823 824 825
		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 ->
826 827
					(subproject.configurations.runtime.resolvedConfiguration.resolvedArtifacts +
					subproject.configurations.optional.resolvedConfiguration.resolvedArtifacts).each { artifact ->
828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848
						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 已提交
849 850
		description = "Generates gradlew[.bat] scripts"
		gradleVersion = "1.3"
851 852 853 854

		doLast() {
			def gradleOpts = "-XX:MaxPermSize=1024m -Xmx1024m"
			def gradleBatOpts = "$gradleOpts -XX:MaxHeapSize=256m"
P
Phillip Webb 已提交
855
			File wrapperFile = file("gradlew")
856 857
			wrapperFile.text = wrapperFile.text.replace("DEFAULT_JVM_OPTS=",
				"GRADLE_OPTS=\"$gradleOpts \$GRADLE_OPTS\"\nDEFAULT_JVM_OPTS=")
P
Phillip Webb 已提交
858
			File wrapperBatFile = file("gradlew.bat")
859 860 861 862
			wrapperBatFile.text = wrapperBatFile.text.replace("set DEFAULT_JVM_OPTS=",
				"set GRADLE_OPTS=$gradleBatOpts %GRADLE_OPTS%\nset DEFAULT_JVM_OPTS=")
		}
	}
863
}