build.gradle 9.6 KB
Newer Older
1
buildscript {
2
	repositories {
3
		maven { url "https://repo.spring.io/plugins-release" }
4 5
	}
	dependencies {
S
Stephane Nicoll 已提交
6
		classpath("io.spring.nohttp:nohttp-gradle:0.0.3.RELEASE")
B
Brian Clozel 已提交
7
		classpath("org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.16")
8
		classpath("io.spring.asciidoctor:spring-asciidoctor-extensions:0.1.3.RELEASE")
9
	}
10 11
}

12
// 3rd party plugin repositories can be configured in settings.gradle
13
plugins {
14
	id 'org.springframework.build.test-sources' apply false
15
	id "io.spring.dependency-management" version "1.0.7.RELEASE" apply false
16
	id "org.jetbrains.kotlin.jvm" version "1.3.41" apply false
S
Sebastien Deleuze 已提交
17
	id "org.jetbrains.dokka" version "0.9.18"
B
Brian Clozel 已提交
18
	id "org.asciidoctor.convert" version "1.5.8"
B
Brian Clozel 已提交
19 20
}

S
Stephane Nicoll 已提交
21
ext {
B
Brian Clozel 已提交
22
	linkHomepage = "https://spring.io/projects/spring-framework"
23
	linkCi = "https://build.spring.io/browse/SPR"
24
	linkIssue = "https://github.com/spring-projects/spring-framework/issues"
25 26 27
	linkScmUrl = "https://github.com/spring-projects/spring-framework"
	linkScmConnection = "scm:git:git://github.com/spring-projects/spring-framework.git"
	linkScmDevConnection = "scm:git:ssh://git@github.com:spring-projects/spring-framework.git"
28

29
	moduleProjects = subprojects.findAll {
30
		(it.name != "spring-framework-bom") && (it.name != "spring-core-coroutines")
31
	}
32

33
	aspectjVersion       = "1.9.4"
34
	coroutinesVersion    = "1.3.0-RC"
35
	freemarkerVersion    = "2.3.28"
J
Juergen Hoeller 已提交
36
	groovyVersion        = "2.5.7"
37
	hsqldbVersion        = "2.5.0"
J
Juergen Hoeller 已提交
38
	jackson2Version      = "2.9.9"
39
	jettyVersion         = "9.4.19.v20190610"
S
Sam Brannen 已提交
40
	junit5Version        = "5.5.1"
41 42
	kotlinVersion        = "1.3.41"
	log4jVersion         = "2.12.0"
43
	nettyVersion         = "4.1.38.Final"
44
	reactorVersion       = "Dysprosium-M3"
45
	rsocketVersion       = "1.0.0-RC2"
46 47
	rxjavaVersion        = "1.3.8"
	rxjavaAdapterVersion = "1.2.1"
48
	rxjava2Version       = "2.2.10"
49
	slf4jVersion         = "1.7.26"	  // spring-jcl + consistent 3rd party deps
50
	tiles3Version        = "3.0.8"
51
	tomcatVersion        = "9.0.22"
52
	undertowVersion      = "2.0.23.Final"
53 54

	gradleScriptDir = "${rootProject.projectDir}/gradle"
55
	withoutJclOverSlf4j = {
56
		exclude group: "org.slf4j", module: "jcl-over-slf4j"
57
	}
S
Stephane Nicoll 已提交
58 59
}

C
Chris Beams 已提交
60
configure(allprojects) { project ->
61
	group = "org.springframework"
62

63 64 65
	apply plugin: "java"
	apply plugin: "kotlin"
	apply plugin: "checkstyle"
66
	apply plugin: 'org.springframework.build.compile'
67
	apply plugin: 'org.springframework.build.optional-dependencies'
68
	apply plugin: 'org.springframework.build.test-sources'
69
	apply plugin: "io.spring.dependency-management"
70
	apply from: "${gradleScriptDir}/ide.gradle"
C
Chris Beams 已提交
71

72 73
	dependencyManagement {
		resolutionStrategy {
74
			cacheChangingModulesFor 0, "seconds"
75 76 77 78 79
		}
		applyMavenExclusions = false
		generatedPomCustomization {
			enabled = false
		}
80 81
		imports {
			mavenBom "org.junit:junit-bom:${junit5Version}"
S
Sebastien Deleuze 已提交
82
			mavenBom "org.jetbrains.kotlin:kotlin-bom:${kotlinVersion}"
83
			mavenBom "org.jetbrains.kotlinx:kotlinx-coroutines-bom:${coroutinesVersion}"
84
		}
85 86
	}

87
	configurations.all {
J
Juergen Hoeller 已提交
88
		// Check for updates every build
89
		resolutionStrategy.cacheChangingModulesFor 0, "seconds"
90 91 92

		// Consistent slf4j version (e.g. clashes between slf4j versions)
		resolutionStrategy.eachDependency { DependencyResolveDetails details ->
93
			if (details.requested.group == "org.slf4j") {
94 95 96
				details.useVersion slf4jVersion
			}
		}
97 98
	}

99 100 101 102 103 104 105 106 107 108 109 110
	compileKotlin {
		kotlinOptions {
			jvmTarget = "1.8"
			freeCompilerArgs = ["-Xjsr305=strict"]
		}
	}

	compileTestKotlin {
		kotlinOptions {
			jvmTarget = "1.8"
			freeCompilerArgs = ["-Xjsr305=strict"]
		}
J
Juergen Hoeller 已提交
111 112
	}

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

126
	checkstyle {
127
		toolVersion = "8.23"
128 129 130
		configDir = rootProject.file("src/checkstyle")
	}

131
	repositories {
132
		mavenCentral()
133
		maven { url "https://repo.spring.io/libs-release" }
134
		maven { url "https://repo.spring.io/milestone" } // Reactor
135
		mavenLocal()
136
	}
C
Chris Beams 已提交
137

138
	dependencies {
S
Sam Brannen 已提交
139
		testCompile("junit:junit:4.13-beta-3") {
140
			exclude group: "org.hamcrest", module: "hamcrest-core"
141
		}
S
Sam Brannen 已提交
142
		testCompile("org.mockito:mockito-core:3.0.0") {
143
			exclude group: "org.hamcrest", module: "hamcrest-core"
144
		}
145
		testCompile("io.mockk:mockk:1.9.3")
146
		testCompile("org.hamcrest:hamcrest-all:1.3")
S
Sam Brannen 已提交
147
		testCompile("org.assertj:assertj-core:3.13.1")
148 149 150 151
		// Pull in the latest JUnit 5 Launcher API and the Vintage engine as well
		// so that we can run JUnit 4 tests in IDEs.
		testRuntime("org.junit.platform:junit-platform-launcher")
		testRuntime("org.junit.vintage:junit-vintage-engine")
152
		testRuntime("org.apache.logging.log4j:log4j-core:${log4jVersion}")
153 154
		testRuntime("org.apache.logging.log4j:log4j-slf4j-impl:${log4jVersion}")
		testRuntime("org.apache.logging.log4j:log4j-jul:${log4jVersion}")
P
Phillip Webb 已提交
155
		// JSR-305 only used for non-required meta-annotations
156 157
		compileOnly("com.google.code.findbugs:jsr305:3.0.2")
		testCompileOnly("com.google.code.findbugs:jsr305:3.0.2")
158
		checkstyle("io.spring.javaformat:spring-javaformat-checkstyle:0.0.7")
159
	}
C
Chris Beams 已提交
160 161

	ext.javadocLinks = [
S
Spring Operator 已提交
162 163
		"https://docs.oracle.com/javase/8/docs/api/",
		"https://docs.oracle.com/javaee/7/api/",
S
Sam Brannen 已提交
164 165
		"https://docs.oracle.com/cd/E13222_01/wls/docs90/javadocs/",  // CommonJ
		"https://www.ibm.com/support/knowledgecenter/SS7JFU_8.5.5/com.ibm.websphere.javadoc.doc/web/apidocs/",
S
Spring Operator 已提交
166 167 168 169 170 171 172
		"https://glassfish.java.net/nonav/docs/v3/api/",
		"https://docs.jboss.org/jbossas/javadoc/4.0.5/connector/",
		"https://docs.jboss.org/jbossas/javadoc/7.1.2.Final/",
		"https://tiles.apache.org/tiles-request/apidocs/",
		"https://tiles.apache.org/framework/apidocs/",
		"https://www.eclipse.org/aspectj/doc/released/aspectj5rt-api/",
		"https://www.ehcache.org/apidocs/2.10.4",
173
		"https://www.quartz-scheduler.org/api/2.3.0/",
S
Spring Operator 已提交
174 175 176 177
		"https://fasterxml.github.io/jackson-core/javadoc/2.9/",
		"https://fasterxml.github.io/jackson-databind/javadoc/2.9/",
		"https://fasterxml.github.io/jackson-dataformat-xml/javadoc/2.9/",
		"https://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/",
178
		"https://junit.org/junit4/javadoc/4.12/",
179
		"https://junit.org/junit5/docs/${junit5Version}/api/"
C
Chris Beams 已提交
180
	] as String[]
181 182
}

183
configure(subprojects.findAll { (it.name != "spring-core-coroutines") } ) { subproject ->
184 185 186
	apply from: "${gradleScriptDir}/publish-maven.gradle"

	jar {
187 188 189 190 191
		manifest.attributes["Implementation-Title"] = subproject.name
		manifest.attributes["Implementation-Version"] = subproject.version
		manifest.attributes["Automatic-Module-Name"] = subproject.name.replace('-', '.')  // for Jigsaw
		manifest.attributes["Created-By"] =
				"${System.getProperty("java.version")} (${System.getProperty("java.specification.vendor")})"
192

193
		from("${rootProject.projectDir}/src/docs/dist") {
194 195 196 197
			include "license.txt"
			include "notice.txt"
			into "META-INF"
			expand(copyright: new Date().format("yyyy"), version: project.version)
198 199 200 201
		}
	}

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

204
		options.encoding = "UTF-8"
205 206 207
		options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
		options.author = true
		options.header = project.name
208
		options.use = true
C
Chris Beams 已提交
209
		options.links(project.ext.javadocLinks)
210
		options.addStringOption("Xdoclint:none", "-quiet")
C
Chris Beams 已提交
211

212 213
		// Suppress warnings due to cross-module @see and @link references.
		// Note that global 'api' task does display all warnings.
C
Chris Beams 已提交
214
		logging.captureStandardError LogLevel.INFO
215
		logging.captureStandardOutput LogLevel.INFO  // suppress "## warnings" message
216 217
	}

218
	task sourcesJar(type: Jar, dependsOn: classes) {
219
		duplicatesStrategy = DuplicatesStrategy.EXCLUDE
220
		classifier = "sources"
221
		from sourceSets.main.allSource
222
		// Don't include or exclude anything explicitly by default. See SPR-12085.
223 224 225
	}

	task javadocJar(type: Jar) {
226
		classifier = "javadoc"
227 228 229 230 231 232 233
		from javadoc
	}

	artifacts {
		archives sourcesJar
		archives javadocJar
	}
C
Chris Beams 已提交
234 235
}

236
configure(rootProject) {
237
	description = "Spring Framework"
238

239
	apply plugin: "groovy"
R
Rob Winch 已提交
240
	apply plugin: "io.spring.nohttp"
241
	apply from: "${gradleScriptDir}/jdiff.gradle"
242
	apply from: "${gradleScriptDir}/docs.gradle"
243

R
Rob Winch 已提交
244 245 246 247 248 249 250 251 252 253 254
	nohttp {
		source.exclude "**/test-output/**"
		whitelistFile = project.file("src/nohttp/whitelist.lines")
		def projectDirURI = project.projectDir.toURI()
		allprojects.forEach { p ->
			def outURI = p.file("out").toURI()
			def pattern = projectDirURI.relativize(outURI).path + "**"
			source.exclude pattern
		}
	}

R
Rob Winch 已提交
255 256 257 258 259 260
	dependencyManagement {
		imports {
			mavenBom "io.projectreactor:reactor-bom:${reactorVersion}"
		}
	}

261
	// Don't publish the default jar for the root project
262 263
	configurations.archives.artifacts.clear()

264
	dependencies {  // for integration tests
265 266 267 268 269 270 271 272 273 274 275 276 277
		testCompile(project(":spring-aop"))
		testCompile(project(":spring-beans"))
		testCompile(project(":spring-context"))
		testCompile(project(":spring-core"))
		testCompile(project(":spring-expression"))
		testCompile(project(":spring-jdbc"))
		testCompile(project(":spring-orm"))
		testCompile(project(":spring-test"))
		testCompile(project(":spring-tx"))
		testCompile(project(":spring-web"))
		testCompile("javax.inject:javax.inject:1")
		testCompile("javax.resource:javax.resource-api:1.7.1")
		testCompile("javax.servlet:javax.servlet-api:3.1.0")
278
		testCompile("org.aspectj:aspectjweaver:${aspectjVersion}")
P
Phillip Webb 已提交
279
		testCompile("org.hsqldb:hsqldb:${hsqldbVersion}")
280
		testCompile("org.hibernate:hibernate-core:5.1.17.Final")
281
		asciidoctor("io.spring.asciidoctor:spring-asciidoctor-extensions:0.1.3.RELEASE")
282 283 284 285 286 287 288 289
	}

	artifacts {
		archives docsZip
		archives schemaZip
		archives distZip
	}

290
}
291