1
- import java.time.Duration
1
+ import com.vanniktech.maven.publish.*
2
2
3
3
plugins {
4
4
id ' java-library'
5
5
id ' checkstyle'
6
6
id ' jacoco'
7
- id ' com.github.spotbugs' version ' 6.0.26'
8
- id ' maven-publish'
9
- id ' signing'
10
- id ' io.github.gradle-nexus.publish-plugin' version ' 2.0.0' // publish to Maven Central
11
- id ' com.github.ben-manes.versions' version ' 0.51.0' // check for out-of-date dependencies (run 'dependencyUpdates' manually)
12
- id ' org.sonatype.gradle.plugins.scan' version ' 2.8.3' // scan for vulnerabilities
13
- id ' org.sonarqube' version ' 5.1.0.4882' // sonarQube analysis
7
+ id ' com.vanniktech.maven.publish' version ' 0.32.0' // publish to Maven Central
8
+ id ' com.github.ben-manes.versions' version ' 0.52.0' // check for out-of-date dependencies (run 'dependencyUpdates' manually)
9
+ id ' com.github.spotbugs' version ' 6.1.11' // spotbugs code analysis
10
+ id ' org.sonatype.gradle.plugins.scan' version ' 3.1.1' // scan for vulnerabilities
11
+ id ' org.sonarqube' version ' 6.1.0.5360' // sonarQube analysis
14
12
}
15
13
16
14
group = ' com.imsweb'
@@ -33,36 +31,32 @@ dependencies {
33
31
34
32
// retrofit will not update these dependencies to fix vulnerabilities
35
33
api ' com.squareup.okhttp3:okhttp:4.12.0'
36
- api ' com.squareup.okio:okio:3.9.1 '
34
+ api ' com.squareup.okio:okio:3.11.0 '
37
35
38
36
// newer version of dependency to fix vulnerability until converter-jackson is updated
39
- api ' com.fasterxml.jackson.core:jackson-databind:2.18.1 '
37
+ api ' com.fasterxml.jackson.core:jackson-databind:2.19.0 '
40
38
41
39
testImplementation ' junit:junit:4.13.2'
42
40
testImplementation ' com.imsweb:seerutils:5.6'
43
41
}
44
42
45
- // enforce UTF-8, display the compilation warnings
43
+ java {
44
+ sourceCompatibility = JavaVersion . VERSION_11
45
+ targetCompatibility = JavaVersion . VERSION_11
46
+ }
47
+
46
48
tasks. withType(JavaCompile ). configureEach {
47
49
options. encoding = ' UTF-8'
48
- options. compilerArgs << ' -Xlint:unchecked' << ' -Xlint:deprecation' << ' -Xlint:rawtypes ' << ' -Werror '
50
+ options. compilerArgs << ' -Xlint:unchecked' << ' -Xlint:deprecation'
49
51
}
50
52
51
- // the Javadoc was made way too strict in Java 8 and it's not worth the time fixing everything!
52
53
tasks. withType(Javadoc ). configureEach {
53
54
options. addStringOption(' Xdoclint:none' , ' -quiet' )
55
+ options. addStringOption(' encoding' , ' UTF-8' )
56
+ options. addStringOption(' charSet' , ' UTF-8' )
57
+ options. addBooleanOption(' html5' , true )
54
58
}
55
59
56
- // generate javadoc and sources (required by Nexus)
57
- java {
58
- sourceCompatibility = JavaVersion . VERSION_11
59
- targetCompatibility = JavaVersion . VERSION_11
60
-
61
- withJavadocJar()
62
- withSourcesJar()
63
- }
64
-
65
- // customize the manifest
66
60
jar {
67
61
manifest {
68
62
attributes(' Implementation-Title' : project. name,
@@ -84,22 +78,19 @@ ossIndexAudit {
84
78
}
85
79
check. dependsOn ' ossIndexAudit'
86
80
87
- // checkstyle plugin settings
88
81
checkstyle {
89
82
ignoreFailures = true
90
83
configFile = project(' :' ). file(' config/checkstyle/checkstyle.xml' )
91
84
configProperties = [' suppressionFile' : project(' :' ). file(' config/checkstyle/suppressions.xml' )]
92
85
}
93
86
94
- // jacoco plugin settings
95
87
jacocoTestReport {
96
88
reports {
97
89
xml. required = true
98
90
}
99
91
}
100
92
test. finalizedBy jacocoTestReport
101
93
102
- // spotbugs plugin settings
103
94
spotbugs {
104
95
ignoreFailures = true
105
96
excludeFilter. set(project(' :' ). file(" config/spotbugs/spotbugs-exclude.xml" ))
@@ -128,87 +119,46 @@ tasks.named("dependencyUpdates").configure {
128
119
}
129
120
}
130
121
131
- // needed to deploy to Maven Central
132
- publishing {
133
- publications {
134
- mavenJava(MavenPublication ) {
135
- artifactId = ' naaccr-api-client'
136
- from components. java
137
- versionMapping {
138
- usage(' java-api' ) {
139
- fromResolutionOf(' runtimeClasspath' )
140
- }
141
- usage(' java-runtime' ) {
142
- fromResolutionResult()
143
- }
144
- }
145
- pom {
146
- name = ' NAACCR API Client'
147
- description = ' Wraps calls to the NAACCR API.'
148
- url = ' https://github.com/imsweb/naaccr-api-client'
149
- inceptionYear = ' 2023'
150
-
151
- licenses {
152
- license {
153
- name = ' A modified BSD License (BSD)'
154
- url = ' https://github.com/imsweb/layout/blob/master/LICENSE'
155
- distribution = ' repo'
156
- }
157
- }
158
-
159
- developers {
160
- developer {
161
- id = ' depryf'
162
- name = ' Fabian Depry'
163
-
164
- }
165
- }
166
-
167
- scm {
168
- url = ' https://github.com/imsweb/naaccr-api-client'
169
- connection = ' scm:https://github.com/imsweb/naaccr-api-client.git'
170
- developerConnection
= ' scm:[email protected] :imsweb/naaccr-api-client.git'
171
- }
172
- }
173
- }
174
- }
175
- }
176
-
177
- // setup JAR signing
178
- signing {
179
- required { ! project. version. endsWith(' -SNAPSHOT' ) }
180
-
181
- String signingKey = project. findProperty(' signingKey' ) ?: ' '
182
- String signingPassword = project. findProperty(' signingPassword' ) ?: ' '
183
-
184
- useInMemoryPgpKeys(signingKey, signingPassword)
122
+ // needed to deploy to Maven Central Portal
123
+ mavenPublishing {
124
+ configure(new JavaLibrary (new JavadocJar.Javadoc (), true ))
185
125
186
- sign publishing . publications . mavenJava
187
- }
126
+ publishToMavenCentral( SonatypeHost . CENTRAL_PORTAL , true )
127
+ signAllPublications()
188
128
189
- // needed to release on maven central
190
- nexusPublishing {
191
- repositories {
192
- sonatype {
193
- stagingProfileId = ' 63e5ddd3ab0d16 '
129
+ pom {
130
+ name = ' NAACCR API Client '
131
+ description = ' Wraps calls to the NAACCR API. '
132
+ url = ' https://github.com/imsweb/naaccr-api-client '
133
+ inceptionYear = ' 2023 '
194
134
195
- username = project. findProperty(" nexusUsername" )
196
- password = project. findProperty(" nexusPassword" )
135
+ licenses {
136
+ license {
137
+ name = ' A modified BSD License (BSD)'
138
+ url = ' https://github.com/imsweb/layout/blob/master/LICENSE'
139
+ distribution = ' repo'
140
+ }
197
141
}
198
- }
199
142
200
- clientTimeout = Duration . ofSeconds(300 )
201
- connectTimeout = Duration . ofSeconds(60 )
143
+ developers {
144
+ developer {
145
+ id = ' depryf'
146
+ name = ' Fabian Depry'
147
+
148
+ }
149
+ }
202
150
203
- transitionCheckOptions {
204
- maxRetries. set(50 )
205
- delayBetween. set(Duration . ofMillis(5000 ))
151
+ scm {
152
+ url = ' https://github.com/imsweb/naaccr-api-client'
153
+ connection = ' scm:https://github.com/imsweb/naaccr-api-client.git'
154
+ developerConnection
= ' scm:[email protected] :imsweb/naaccr-api-client.git'
155
+ }
206
156
}
207
157
}
208
158
209
159
// Gradle wrapper, this allows to build the project without having to install Gradle!
210
160
wrapper {
211
- gradleVersion = ' 8.11 '
161
+ gradleVersion = ' 8.14 '
212
162
distributionType = Wrapper.DistributionType . ALL
213
163
}
214
164
0 commit comments