-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
166 lines (137 loc) · 3.82 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
plugins {
id 'io.spring.dependency-management' version '1.0.5.RELEASE' apply false
id 'org.springframework.boot' version '2.0.2.RELEASE' apply false
id 'cn.bestwu.propdeps-maven' version '0.0.10' apply false
id 'cn.bestwu.propdeps-idea' version '0.0.10' apply false
id 'cn.bestwu.propdeps' version '0.0.10' apply false
}
// all projects configs
allprojects {
buildscript {
ext {
lombokVersion = '1.16.20'
springBootVersion = '2.0.2.RELEASE'
junitPlatformVersion = '1.2.0'
junitJupiterVersion = '5.2.0'
hamcrestVersion = '1.3'
junit4Version = '4.12'
}
repositories {
mavenCentral()
}
}
apply plugin: 'java'
version = '0.0.1-SNAPSHOT'
group = 'com.github.daggerok'
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8
defaultTasks 'clean', 'build', 'publish'
repositories {
mavenCentral()
}
dependencies {
compileOnly("org.projectlombok:lombok:$lombokVersion")
testCompileOnly("org.projectlombok:lombok:$lombokVersion")
annotationProcessor("org.projectlombok:lombok:$lombokVersion")
testAnnotationProcessor("org.projectlombok:lombok:$lombokVersion")
}
javadoc {
failOnError = false
}
// clean
clean.doFirst {
["out"]
.collect { "$projectDir/$it" }
.each { delete }
}
// output log
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}
// publish
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'cn.bestwu.propdeps-maven'
task sourcesJar(type: Jar) {
from sourceSets.main.allJava
classifier = 'sources'
}
task javadocsJar(type: Jar) {
classifier = "javadocs"
from javadoc
}
artifacts {
archives sourcesJar, javadocsJar
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourcesJar {
classifier = 'sources'
}
artifact javadocsJar {
classifier = 'javadocs'
}
}
}
}
publishing {
repositories {
maven {
url "$rootProject.buildDir/maven-publish"
}
}
}
}
// all sub-projects (spring-boot) configs
subprojects {
apply plugin: 'io.spring.dependency-management'
apply plugin: 'org.springframework.boot'
apply plugin: 'cn.bestwu.propdeps'
assemble.dependsOn(processResources)
dependencies {
implementation('org.springframework.boot:spring-boot-starter')
annotationProcessor('org.springframework.boot:spring-boot-configuration-processor')
testAnnotationProcessor('org.springframework.boot:spring-boot-configuration-processor')
testImplementation('org.springframework.boot:spring-boot-starter-test')
}
}
// junit 5
allprojects {
dependencies {
testImplementation("junit:junit:$junit4Version")
testImplementation("org.hamcrest:hamcrest-core:$hamcrestVersion")
testImplementation("org.junit.jupiter:junit-jupiter-api:$junitJupiterVersion")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$junitJupiterVersion")
//testCompileOnly("org.apiguardian:apiguardian-api:1.0.0")
testRuntimeOnly("org.junit.vintage:junit-vintage-engine:$junitJupiterVersion") {
because 'allows JUnit 3 and JUnit 4 tests to run'
}
testRuntime("org.junit.platform:junit-platform-launcher:$junitPlatformVersion") {
because 'allows tests to run from IDEs that bundle older version of launcher'
}
}
test {
useJUnitPlatform {
includeEngines 'junit-jupiter', 'junit-vintage'
}
}
}
// idea sources
apply plugin: 'idea'
allprojects*.apply plugin: 'cn.bestwu.propdeps-idea'
idea {
module {
downloadJavadoc = false
downloadSources = true
}
}
// gradle wrapper
wrapper {
gradleVersion = '4.7'
distributionType = 'BIN'
}