build.gradle 6.8 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
17
	id "org.jetbrains.dokka" version "0.9.18" apply false
B
Brian Clozel 已提交
18
	id "org.asciidoctor.convert" version "1.5.8"
B
Brian Clozel 已提交
19 20
}

S
Stephane Nicoll 已提交
21
ext {
22
	moduleProjects = subprojects.findAll {
23
		(it.name != "spring-framework-bom") && (it.name != "spring-core-coroutines") && (it.name != "integration-tests")
24
	}
25

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

47
	withoutJclOverSlf4j = {
48
		exclude group: "org.slf4j", module: "jcl-over-slf4j"
49
	}
S
Stephane Nicoll 已提交
50 51
}

52
configure(allprojects.findAll { (it.name != "spring-framework-bom") } ) { project ->
53
	group = "org.springframework"
54

55 56
	apply plugin: "java"
	apply plugin: "checkstyle"
57
	apply plugin: 'org.springframework.build.compile'
58
	apply plugin: "io.spring.dependency-management"
59
	apply from: "${rootDir}/gradle/ide.gradle"
C
Chris Beams 已提交
60

61 62
	dependencyManagement {
		resolutionStrategy {
63
			cacheChangingModulesFor 0, "seconds"
64 65 66 67 68
		}
		applyMavenExclusions = false
		generatedPomCustomization {
			enabled = false
		}
69 70
		imports {
			mavenBom "org.junit:junit-bom:${junit5Version}"
S
Sebastien Deleuze 已提交
71
			mavenBom "org.jetbrains.kotlin:kotlin-bom:${kotlinVersion}"
72
			mavenBom "org.jetbrains.kotlinx:kotlinx-coroutines-bom:${coroutinesVersion}"
73
		}
74 75
	}

76
	configurations.all {
J
Juergen Hoeller 已提交
77
		// Check for updates every build
78
		resolutionStrategy.cacheChangingModulesFor 0, "seconds"
79 80 81

		// Consistent slf4j version (e.g. clashes between slf4j versions)
		resolutionStrategy.eachDependency { DependencyResolveDetails details ->
82
			if (details.requested.group == "org.slf4j") {
83 84 85
				details.useVersion slf4jVersion
			}
		}
86 87
	}

88 89 90 91 92 93 94
	pluginManager.withPlugin("kotlin") {
		apply plugin: "org.jetbrains.dokka"
		compileKotlin {
			kotlinOptions {
				jvmTarget = "1.8"
				freeCompilerArgs = ["-Xjsr305=strict"]
			}
95
		}
96 97 98 99 100
		compileTestKotlin {
			kotlinOptions {
				jvmTarget = "1.8"
				freeCompilerArgs = ["-Xjsr305=strict"]
			}
101
		}
J
Juergen Hoeller 已提交
102 103
	}

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

117
	checkstyle {
118
		toolVersion = "8.23"
119 120 121
		configDir = rootProject.file("src/checkstyle")
	}

122
	repositories {
123
		mavenCentral()
124
		maven { url "https://repo.spring.io/libs-release" }
125
		maven { url "https://repo.spring.io/milestone" } // Reactor
126
		mavenLocal()
127
	}
C
Chris Beams 已提交
128

129
	dependencies {
130 131
		testCompile("org.junit.jupiter:junit-jupiter-api")
		testCompile("org.junit.jupiter:junit-jupiter-params")
S
Sam Brannen 已提交
132
		testCompile("org.mockito:mockito-core:3.0.0") {
133
			exclude group: "org.hamcrest", module: "hamcrest-core"
134
		}
135
		testCompile("org.mockito:mockito-junit-jupiter:3.0.0")
136
		testCompile("io.mockk:mockk:1.9.3")
S
Sam Brannen 已提交
137
		testCompile("org.hamcrest:hamcrest:2.1")
S
Sam Brannen 已提交
138
		testCompile("org.assertj:assertj-core:3.13.1")
139
		// Pull in the latest JUnit 5 Launcher API to ensure proper support in IDEs.
140
		testRuntime("org.junit.platform:junit-platform-launcher")
141
		testRuntime("org.junit.jupiter:junit-jupiter-engine")
142
		testRuntime("org.apache.logging.log4j:log4j-core:${log4jVersion}")
143 144
		testRuntime("org.apache.logging.log4j:log4j-slf4j-impl:${log4jVersion}")
		testRuntime("org.apache.logging.log4j:log4j-jul:${log4jVersion}")
P
Phillip Webb 已提交
145
		// JSR-305 only used for non-required meta-annotations
146 147
		compileOnly("com.google.code.findbugs:jsr305:3.0.2")
		testCompileOnly("com.google.code.findbugs:jsr305:3.0.2")
148
		checkstyle("io.spring.javaformat:spring-javaformat-checkstyle:0.0.15")
149
	}
C
Chris Beams 已提交
150 151

	ext.javadocLinks = [
S
Spring Operator 已提交
152 153
		"https://docs.oracle.com/javase/8/docs/api/",
		"https://docs.oracle.com/javaee/7/api/",
S
Sam Brannen 已提交
154 155
		"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 已提交
156 157 158 159 160 161 162
		"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",
163
		"https://www.quartz-scheduler.org/api/2.3.0/",
S
Spring Operator 已提交
164 165 166 167
		"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/",
168
		"https://junit.org/junit4/javadoc/4.12/",
169
		"https://junit.org/junit5/docs/${junit5Version}/api/"
C
Chris Beams 已提交
170
	] as String[]
171 172
}

173 174
configure(moduleProjects) { project ->
	apply from: "${rootDir}/gradle/spring-module.gradle"
C
Chris Beams 已提交
175 176
}

177
configure(rootProject) {
178
	description = "Spring Framework"
179

180
	apply plugin: "groovy"
181
	apply plugin: "kotlin"
R
Rob Winch 已提交
182
	apply plugin: "io.spring.nohttp"
183
	apply plugin: 'org.springframework.build.api-diff'
184
	apply from: "${rootDir}/gradle/docs.gradle"
185

R
Rob Winch 已提交
186 187 188 189 190 191 192 193 194 195 196
	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 已提交
197 198 199 200 201 202
	dependencyManagement {
		imports {
			mavenBom "io.projectreactor:reactor-bom:${reactorVersion}"
		}
	}

203
	dependencies {
204
		asciidoctor("io.spring.asciidoctor:spring-asciidoctor-extensions:0.1.3.RELEASE")
205 206 207 208 209 210 211
	}

	artifacts {
		archives docsZip
		archives schemaZip
		archives distZip
	}
212
}
213