build.gradle 6.8 KB
Newer Older
1
buildscript {
2
	dependencies {
3 4
		classpath 'org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.16'
		classpath 'io.spring.asciidoctor:spring-asciidoctor-extensions:0.1.3.RELEASE'
5
	}
6
}
7
plugins {
8
	id 'io.spring.dependency-management' version '1.0.7.RELEASE' apply false
S
Sebastien Deleuze 已提交
9
	id 'org.jetbrains.kotlin.jvm' version '1.3.50' apply false
10 11 12 13
	id 'org.jetbrains.dokka' version '0.9.18' apply false
	id 'org.asciidoctor.convert' version '1.5.8'
	id 'io.spring.nohttp' version '0.0.3.RELEASE'
	id 'de.undercouch.download' version '4.0.0'
B
Brian Clozel 已提交
14
	id "com.jfrog.artifactory" version '4.9.8' apply false
15
	id "io.freefair.aspectj" version "4.0.0" apply false
B
Brian Clozel 已提交
16 17
}

S
Stephane Nicoll 已提交
18
ext {
19
	moduleProjects = subprojects.findAll { it.name.startsWith("spring-") }
20

21
	aspectjVersion       = "1.9.4"
S
Sebastien Deleuze 已提交
22
	coroutinesVersion    = "1.3.0"
23
	freemarkerVersion    = "2.3.28"
J
Juergen Hoeller 已提交
24
	groovyVersion        = "2.5.7"
25
	hsqldbVersion        = "2.5.0"
J
Juergen Hoeller 已提交
26
	jackson2Version      = "2.9.9"
27
	jettyVersion         = "9.4.20.v20190813"
S
Sam Brannen 已提交
28
	junit5Version        = "5.5.1"
S
Sebastien Deleuze 已提交
29
	kotlinVersion        = "1.3.50"
30
	log4jVersion         = "2.12.0"
31
	nettyVersion         = "4.1.38.Final"
32
	reactorVersion       = "Dysprosium-M3"
R
Rossen Stoyanchev 已提交
33
	rsocketVersion       = "1.0.0-RC3"
34 35
	rxjavaVersion        = "1.3.8"
	rxjavaAdapterVersion = "1.2.1"
36
	rxjava2Version       = "2.2.10"
37
	slf4jVersion         = "1.7.26"	  // spring-jcl + consistent 3rd party deps
38
	tiles3Version        = "3.0.8"
39
	tomcatVersion        = "9.0.22"
40
	undertowVersion      = "2.0.23.Final"
41

42
	withoutJclOverSlf4j = {
43
		exclude group: "org.slf4j", module: "jcl-over-slf4j"
44
	}
S
Stephane Nicoll 已提交
45 46
}

47
configure(allprojects.findAll { (it.name != "framework-bom") } ) { project ->
48
	group = "org.springframework"
49

50 51
	apply plugin: "java"
	apply plugin: "checkstyle"
52
	apply plugin: 'org.springframework.build.compile'
53
	apply plugin: "io.spring.dependency-management"
54
	apply from: "${rootDir}/gradle/ide.gradle"
C
Chris Beams 已提交
55

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

71
	configurations.all {
J
Juergen Hoeller 已提交
72
		// Check for updates every build
73
		resolutionStrategy.cacheChangingModulesFor 0, "seconds"
74 75 76

		// Consistent slf4j version (e.g. clashes between slf4j versions)
		resolutionStrategy.eachDependency { DependencyResolveDetails details ->
77
			if (details.requested.group == "org.slf4j") {
78 79 80
				details.useVersion slf4jVersion
			}
		}
81 82
	}

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

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

113
	checkstyle {
114
		toolVersion = "8.23"
115 116 117
		configDir = rootProject.file("src/checkstyle")
	}

118
	repositories {
119
		mavenCentral()
120
		maven { url "https://repo.spring.io/libs-release" }
121
		maven { url "https://repo.spring.io/milestone" } // Reactor
122
	}
C
Chris Beams 已提交
123

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

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

168 169
configure(moduleProjects) { project ->
	apply from: "${rootDir}/gradle/spring-module.gradle"
C
Chris Beams 已提交
170 171
}

172
configure(rootProject) {
173
	description = "Spring Framework"
174

175
	apply plugin: "groovy"
176
	apply plugin: "kotlin"
R
Rob Winch 已提交
177
	apply plugin: "io.spring.nohttp"
178
	apply plugin: 'org.springframework.build.api-diff'
179
	apply from: "${rootDir}/gradle/publications.gradle"
180
	apply from: "${rootDir}/gradle/docs.gradle"
181

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

199
	dependencies {
200
		asciidoctor("io.spring.asciidoctor:spring-asciidoctor-extensions:0.1.3.RELEASE")
201 202
	}

203 204
	publishing {
		publications {
205
			mavenJava(MavenPublication) {
206 207 208 209 210
				artifact docsZip
				artifact schemaZip
				artifact distZip
			}
		}
211
	}
212
}
213