-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
128 lines (99 loc) · 3.12 KB
/
build.gradle.kts
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
buildscript {
repositories {
gradlePluginPortal()
}
dependencies {
classpath("com.google.protobuf:protobuf-gradle-plugin:0.8.17")
}
}
plugins {
java
`java-library`
id("org.springframework.boot") version "2.7.1"
id("jacoco")
id("org.sonarqube") version "3.3"
}
val projectVersion = "1.0.0-SNAPSHOT"
extra["dubbo_version"] = "3.0.9"
extra["projectVersion"] = projectVersion
extra["slf4jVersion"] = "1.7.36"
extra["spring.boot"] = "2.7.1"
extra["junit.version"] = "5.8.2"
extra["myddd_version"] = "0.3.2-ALPHA"
extra["h2_version"] = "2.1.214"
extra["protobuf-java"] = "3.19.1"
extra["annotation-api"] = "1.3.2"
extra["mysql_jdbc"] = "8.0.26"
extra["mariadb-java-client"] = "3.0.3"
extra["guava.version"] = "31.1-jre"
extra["mockito.version"] = "4.3.1"
extra["log4j-version"] = "2.17.2"
group = "org.myddd.java.micro"
version = extra["projectVersion"]!!
allprojects {
configurations.all {
resolutionStrategy.cacheChangingModulesFor(0, "seconds")
}
repositories {
maven {
setUrl("https://maven.aliyun.com/repository/public/")
}
maven {
setUrl("https://maven.aliyun.com/repository/spring/")
}
mavenCentral()
maven {
setUrl("https://maven.myddd.org/releases/")
}
maven {
setUrl("https://maven.myddd.org/snapshots/")
}
}
}
subprojects {
apply(plugin = "java")
apply(plugin = "jacoco")
apply(plugin = "org.sonarqube")
jacoco {
toolVersion = "0.8.7"
}
tasks.jacocoTestReport {
reports {
xml.required.set(true)
csv.required.set(false)
html.outputLocation.set(layout.buildDirectory.dir("jacocoHtml"))
}
}
tasks.test {
finalizedBy(tasks.jacocoTestReport) // report is always generated after tests run
}
tasks.jacocoTestReport {
dependsOn(tasks.test) // tests are required to run before generating the report
}
tasks.withType<Test>().configureEach {
useJUnitPlatform()
}
allprojects {
tasks.withType<JavaCompile> {
sourceCompatibility = "11"
targetCompatibility = "11"
}
}
//默认测试依赖
dependencies {
implementation("com.google.guava:guava:${rootProject.extra["guava.version"]}")
testImplementation("org.mockito:mockito-core:${rootProject.extra["mockito.version"]}")
testImplementation("org.junit.jupiter:junit-jupiter-api:${rootProject.extra["junit.version"]}")
testImplementation("org.junit.jupiter:junit-jupiter-engine:${rootProject.extra["junit.version"]}")
testImplementation("org.springframework.boot:spring-boot-starter-test:${rootProject.extra["spring.boot"]}")
testImplementation("com.h2database:h2:${rootProject.extra["h2_version"]}")
testImplementation("org.apache.logging.log4j:log4j-core:${rootProject.extra["log4j-version"]}")
testImplementation("org.apache.logging.log4j:log4j-jpl:${rootProject.extra["log4j-version"]}")
}
}
tasks.bootJar {
enabled = false
}
tasks.jar {
enabled = true
}