generated from GoodforGod/java-library-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
217 lines (190 loc) · 6.48 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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
buildscript {
dependencies {
classpath "com.diffplug.spotless:spotless-plugin-gradle:6.19.0"
}
}
plugins {
id "base"
id "jacoco"
id "jacoco-report-aggregation"
id "org.sonarqube" version "5.1.0.4882"
id "io.github.gradle-nexus.publish-plugin" version "2.0.0"
}
sonarqube {
properties {
property "sonar.host.url", "https://sonarcloud.io"
property "sonar.organization", "goodforgod"
property "sonar.projectKey", "GoodforGod_$artifactRootId"
property "sonar.coverage.jacoco.xmlReportPaths", "build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml"
}
}
dependencies {
jacocoAggregation project(":common")
jacocoAggregation project(":jdbc")
jacocoAggregation project(":postgres")
jacocoAggregation project(":oracle")
jacocoAggregation project(":mysql")
jacocoAggregation project(":mariadb")
jacocoAggregation project(":cockroachdb")
jacocoAggregation project(":kafka")
jacocoAggregation project(":cassandra")
jacocoAggregation project(":redis")
jacocoAggregation project(":mockserver")
jacocoAggregation project(":minio")
jacocoAggregation project(":clickhouse")
}
reporting {
reports {
testCodeCoverageReport(JacocoCoverageReport) {
testType = TestSuiteType.UNIT_TEST
}
}
}
allprojects {
group = groupId
var ver = System.getenv().getOrDefault("RELEASE_VERSION", artifactVersion)
version = ver.startsWith("v") ? ver.substring(1) : ver
repositories {
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
}
subprojects {
apply plugin: "jacoco"
apply plugin: "java-library"
apply plugin: "com.diffplug.spotless"
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
dependencies {
compileOnly "org.jetbrains:annotations:24.0.1"
testRuntimeOnly "ch.qos.logback:logback-classic:1.5.0"
testRuntimeOnly libs.junit.engine
testRuntimeOnly libs.testcontainers.junit
testImplementation libs.junit.api
testImplementation libs.junit.params
}
test {
failFast(false)
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
exceptionFormat("full")
showStandardStreams(true)
}
reports {
html.required = false
junitXml.required = true
}
environment([
"MY_ALIAS_ENV": "my_alias_env",
"MY_IMAGE_ENV": "redis:7.2-alpine",
])
}
spotless {
java {
encoding("UTF-8")
importOrder()
removeUnusedImports()
eclipse("4.21").configFile("${rootDir}/config/codestyle.xml")
}
}
tasks.withType(JavaCompile) {
options.encoding("UTF-8")
options.incremental(true)
options.fork = true
}
check.dependsOn jacocoTestReport
jacocoTestReport {
reports {
xml.required = true
html.destination file("${buildDir}/jacocoHtml")
}
}
javadoc {
options.encoding = "UTF-8"
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption("html5", true)
}
}
}
nexusPublishing {
packageGroup = groupId
repositories {
sonatype {
username = System.getenv("OSS_USERNAME")
password = System.getenv("OSS_PASSWORD")
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
}
}
}
subprojects {
apply plugin: "maven-publish"
apply plugin: "org.sonarqube"
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifactId = "$artifactRootId-${project.name}"
var artifactName = artifactId
pom {
url = "https://github.com/GoodforGod/$artifactRootId"
name = artifactName
description = "Testcontainers ${artifactName.capitalize()} Extension with advanced testing features"
license {
name = "Apache License 2.0"
url = "https://github.com/GoodforGod/$artifactRootId/blob/master/LICENSE"
distribution = "repo"
}
developer {
id = "GoodforGod"
name = "Anton Kurako"
email = "[email protected]"
url = "https://github.com/GoodforGod"
}
scm {
connection = "scm:git:git://github.com/GoodforGod/${artifactRootId}.git"
developerConnection = "scm:git:ssh://GoodforGod/${artifactRootId}.git"
url = "https://github.com/GoodforGod/$artifactRootId/tree/master"
}
}
}
}
repositories {
maven {
name = "OSSRH"
def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2"
def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
url = version.endsWith("SNAPSHOT") ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username System.getenv("OSS_USERNAME")
password System.getenv("OSS_PASSWORD")
}
}
if (!version.endsWith("SNAPSHOT")) {
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/GoodforGod/$artifactRootId"
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}
}
java {
withJavadocJar()
withSourcesJar()
}
if (project.hasProperty("signingKey")) {
apply plugin: "signing"
signing {
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.mavenJava
}
}
}