-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.gradle
166 lines (136 loc) · 4.02 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 "fr.brouillard.oss.gradle.jgitver" version "$gradleJgitverPluginVersion"
id "io.freefair.aggregate-javadoc-legacy" version "$gradleAggregateJavadocPluginVersion"
id "io.github.gradle-nexus.publish-plugin" version "$gradlePublishPluginVersion"
id "jacoco-report-aggregation"
}
reporting {
reports {
testCodeCoverageReport(JacocoCoverageReport) {
testType = TestSuiteType.UNIT_TEST
}
}
}
jgitver {
mavenLike true
policy {
pattern = "(.*)"
transformations = ["IGNORE"]
}
}
allprojects {
repositories {
mavenLocal()
mavenCentral()
}
configurations {
compileOnly.extendsFrom(annotationProcessor)
springBom
annotationProcessor.extendsFrom(springBom)
implementation.extendsFrom(springBom)
testAnnotationProcessor.extendsFrom(springBom)
}
}
Project parent = project
subprojects { Project subproject ->
boolean isPlatformProject = subproject.name.endsWith("bom")
apply plugin: "maven-publish"
apply plugin: "signing"
if (isPlatformProject) {
apply plugin: "java-platform"
}
else {
apply plugin: "java"
apply plugin: "java-library"
apply plugin: "jacoco"
sourceCompatibility = "17"
java {
["envers", "reactor", "web", "webMvc", "webFlux", "hibernate", "spel"].forEach {
registerFeature(it) {
usingSourceSet(sourceSets.main)
}
}
withSourcesJar()
withJavadocJar()
}
dependencies {
springBom platform("org.springframework.boot:spring-boot-dependencies:$springBootVersion")
constraints {
implementation "org.apache.poi:poi:$apachePoiVersion"
implementation "org.apache.poi:poi-ooxml:$apachePoiVersion"
implementation "org.modelmapper:modelmapper:$modelMapperVersion"
implementation "org.reflections:reflections:$reflectionsVersion"
}
}
test {
useJUnitPlatform()
jvmArgs = ["-XX:TieredStopAtLevel=1"]
}
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
options.compilerArgs << "-parameters"
}
parent.dependencies {
jacocoAggregation subproject
}
}
group = "net.croz.nrich"
publishing {
publications {
mavenJava(MavenPublication) {
from isPlatformProject ? components.javaPlatform : components.java
suppressAllPomMetadataWarnings()
pom {
afterEvaluate {
name = project.name
description = project.description
}
url = projectRepositoryUrl
licenses {
license {
name = licenseName
url = licenseUrl
}
}
developers {
developer {
name = developerName
email = developerEmail
organization = developerOrganization
organizationUrl = developerOrganizationUrl
}
}
String gitRepositoryUrl = "scm:git:${projectRepositoryUrl}.git"
scm {
connection = gitRepositoryUrl
developerConnection = gitRepositoryUrl
url = projectRepositoryUrl
}
}
}
}
}
signing {
// The gpg private key needs to be stored in ascii-armored format
useInMemoryPgpKeys(System.getenv("GPG_PRIVATE_KEY"), System.getenv("GPG_PASSPHRASE"))
sign publishing.publications.mavenJava
}
tasks.withType(Sign) {
onlyIf {
System.getenv("GPG_PRIVATE_KEY") && System.getenv("GPG_PASSPHRASE")
}
}
}
nexusPublishing {
repositories {
sonatype {
nexusUrl = uri("$sonatypeNexusUrl/service/local/")
snapshotRepositoryUrl = uri("$sonatypeNexusUrl/content/repositories/snapshots/")
username = System.getenv("SONATYPE_TOKEN_USERNAME")
password = System.getenv("SONATYPE_TOKEN_PASSWORD")
// Specifying the configuration property explicitly rather than relying on the API call
// is considered a performance optimization and can reduce execution time by several seconds
stagingProfileId = System.getenv("SONATYPE_STAGING_PROFILE_ID")
}
}
}