-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathbuild.gradle
166 lines (145 loc) · 4.87 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 "org.springframework.boot" version "$LIB_SPRING_BOOT_VER" apply false
id "org.sonarqube" version "4.4.1.3373"
id "jacoco"
id "io.github.gradle-nexus.publish-plugin" version '1.3.0'
}
sonar {
properties {
property "sonar.projectKey", "graphql-java-kickstart_graphql-spring-webclient"
property "sonar.organization", "graphql-java-kickstart"
property "sonar.host.url", "https://sonarcloud.io"
}
}
subprojects {
apply plugin: 'idea'
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'jacoco'
apply plugin: 'org.sonarqube'
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: "io.spring.dependency-management"
repositories {
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
maven { url "https://repo.spring.io/libs-milestone" }
}
dependencyManagement {
imports {
mavenBom "org.springframework.boot:spring-boot-starter-parent:$LIB_SPRING_BOOT_VER"
}
}
dependencies {
compileOnly "org.projectlombok:lombok"
annotationProcessor "org.projectlombok:lombok"
testCompileOnly "org.projectlombok:lombok"
testAnnotationProcessor "org.projectlombok:lombok"
}
test {
useJUnitPlatform()
}
idea {
module {
downloadJavadoc = true
downloadSources = true
}
}
compileJava {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
compileJava.dependsOn(processResources)
//disable Gradle Metadata generation as it may cause unwanted side effects
tasks.withType(GenerateModuleMetadata) {
enabled = false
}
jar {
from "LICENSE.md"
}
java {
withSourcesJar()
withJavadocJar()
}
jacocoTestReport {
reports {
xml.required = true
html.required = false
csv.required = false
}
}
if (!version.toString().endsWith('-SNAPSHOT')) {
ext["signing.keyId"] = System.env.SIGNING_KEY_ID
ext["signing.password"] = System.env.SIGNING_PASSWORD
ext["signing.secretKeyRingFile"] = System.env.SIGNING_SECRET_KEY_RING_FILE
signing {
sign publishing.publications
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
// to avoid "Publication only contains dependencies and/or constraints without a version" error
// see https://docs.gradle.org/6.2.1/userguide/publishing_maven.html#publishing_maven:resolved_dependencies
versionMapping {
usage('java-api') {
fromResolutionOf('runtimeClasspath')
}
usage('java-runtime') {
fromResolutionResult()
}
}
pom {
name = PROJECT_NAME
description = PROJECT_DESC
url = PROJECT_GIT_REPO_URL
scm {
url = PROJECT_GIT_REPO_URL
connection = PROJECT_GIT_REPO_URL
developerConnection = PROJECT_GIT_REPO_URL
}
licenses {
license {
name = PROJECT_LICENSE
url = PROJECT_LICENSE_URL
distribution = 'repo'
}
}
developers {
developer {
id = PROJECT_DEV_ID
name = PROJECT_DEV_NAME
}
}
}
}
}
repositories {
maven {
name 'ossrh'
if (version.toString().endsWith("-SNAPSHOT")) {
url "https://oss.sonatype.org/content/repositories/snapshots/"
} else {
url "https://oss.sonatype.org/service/local/staging/deploy/maven2"
}
credentials {
username = System.env.OSS_USER_TOKEN_KEY ?: project.findProperty('OSS_USER_TOKEN_KEY') ?: ''
password = System.env.OSS_USER_TOKEN_PASS ?: project.findProperty('OSS_USER_TOKEN_PASS') ?: ''
}
}
}
}
}
nexusPublishing {
repositories {
sonatype {
username = System.env.OSS_USER_TOKEN_KEY ?: project.findProperty('OSS_USER_TOKEN_KEY') ?: ''
password = System.env.OSS_USER_TOKEN_PASS ?: project.findProperty('OSS_USER_TOKEN_PASS') ?: ''
}
}
}
wrapper {
distributionType = Wrapper.DistributionType.ALL
}