1+ import com.vanniktech.maven.publish.JavaLibrary
2+ import com.vanniktech.maven.publish.JavadocJar
3+ import com.vanniktech.maven.publish.SonatypeHost
4+
15plugins {
26 id ' java-library'
37 id ' checkstyle'
48 id ' jacoco'
59 id " com.github.spotbugs" version " 6.1.11"
6- id ' maven-publish'
7- id ' signing'
8- id " io.codearte.nexus-staging" version " 0.30.0"
910 id ' com.adarshr.test-logger' version ' 4.0.0'
1011 id " com.github.ben-manes.versions" version " 0.52.0"
1112 id ' org.sonatype.gradle.plugins.scan' version ' 3.1.1'
1213 id " org.sonarqube" version " 6.1.0.5360"
14+ id ' com.vanniktech.maven.publish' version ' 0.31.0'
1315}
1416
1517group = ' com.imsweb'
16- version = ' 5.7 '
18+ version = ' 5.8-SNAPSHOT '
1719description = ' Java client library for SEER*API'
1820
1921tasks. withType(JavaCompile ). configureEach {
@@ -24,9 +26,6 @@ tasks.withType(JavaCompile).configureEach {
2426java {
2527 sourceCompatibility = JavaVersion . VERSION_1_8
2628 targetCompatibility = JavaVersion . VERSION_1_8
27-
28- withJavadocJar()
29- withSourcesJar()
3029}
3130
3231repositories {
@@ -70,33 +69,45 @@ jar {
7069 }
7170}
7271
72+ tasks. withType(JavaCompile ). configureEach {
73+ options. encoding = ' UTF-8'
74+ options. compilerArgs << " -Werror" << " -Xlint:-options"
75+ }
76+
7377tasks. withType(Javadoc ). configureEach {
7478 failOnError false
7579 options. addStringOption(' Xdoclint:none' , ' -quiet' )
7680 options. addStringOption(' encoding' , ' UTF-8' )
7781 options. addStringOption(' charSet' , ' UTF-8' )
7882}
7983
84+ javadoc {
85+ if (JavaVersion . current(). isJava9Compatible()) {
86+ options. addBooleanOption(' html5' , true )
87+ }
88+ }
89+
8090test {
8191 useJUnitPlatform()
8292}
8393
94+ test. finalizedBy jacocoTestReport
95+
96+ jacocoTestReport {
97+ reports {
98+ xml. required = true
99+ }
100+ }
101+
84102checkstyle {
85- toolVersion ' 8.29'
103+ toolVersion = ' 8.29'
86104 configFile = file(" config/checkstyle/checkstyle.xml" )
87105}
88106
89107spotbugs {
90108 excludeFilter = file(' config/spotbugs/spotbugs-exclude.xml' )
91109}
92110
93- jacocoTestReport {
94- reports {
95- xml. required = true
96- }
97- }
98- test. finalizedBy jacocoTestReport
99-
100111sonarqube {
101112 properties {
102113 property " sonar.projectKey" , " imsweb_seerapi-client-java"
@@ -105,115 +116,51 @@ sonarqube {
105116 }
106117}
107118
108- // Nexus vulnerability scan (see https://github.com/sonatype-nexus-community/scan-gradle-plugin)
109119ossIndexAudit {
110120 outputFormat = ' DEPENDENCY_GRAPH'
111121 printBanner = false
112122}
113123
114- def isNonStable = { String version ->
115- def stableKeyword = [' RELEASE' , ' FINAL' , ' GA' ]. any { it -> version. toUpperCase(). contains(it) }
116- def regex = / ^[0-9,.v-]+(-r)?$/
117- return ! stableKeyword && ! (version ==~ regex)
118- }
124+ mavenPublishing {
125+ configure(new JavaLibrary (new JavadocJar.Javadoc (), true ))
119126
120- // https://github.com/ben-manes/gradle-versions-plugin
121- tasks. named(" dependencyUpdates" ). configure {
122- rejectVersionIf {
123- isNonStable(it. candidate. version)
124- }
125- }
127+ publishToMavenCentral(SonatypeHost . CENTRAL_PORTAL , true )
128+ signAllPublications()
126129
127- wrapper {
128- gradleVersion = ' 8.14 '
129- distributionType = Wrapper.DistributionType . ALL
130- }
130+ pom {
131+ name = ' SEER*API Java Client '
132+ description = ' API mapping for SEER*API in Java '
133+ url = ' https://github.com/imsweb/seerapi-client-java '
131134
132- // don't try to release a snapshot to a non-snapshot repository, that won't work anyway
133- if (version. endsWith(' -SNAPSHOT' )) {
134- gradle. startParameter. excludedTaskNames + = ' signMavenJavaPublication'
135- gradle. startParameter. excludedTaskNames + = ' closeAndReleaseRepository'
136- }
137-
138- publishing {
139- publications {
140- mavenJava(MavenPublication ) {
141- artifactId = ' seerapi-client-java'
142- from components. java
143- versionMapping {
144- usage(' java-api' ) {
145- fromResolutionOf(' runtimeClasspath' )
146- }
147- usage(' java-runtime' ) {
148- fromResolutionResult()
149- }
150- }
151- pom {
152- name = ' SEER*API Java Client'
153- description = ' API mapping for SEER*API in Java'
154- url = ' https://github.com/imsweb/seerapi-client-java'
155- inceptionYear = ' 2014'
156-
157- licenses {
158- license {
159- name = ' The MIT License (MIT)'
160- url = ' http://www.opensource.org/licenses/mit-license.php'
161- distribution = ' repo'
162- }
163- }
164-
165- developers {
166- developer {
167- id = ' ctmay4'
168- name = ' Chuck May'
169- email = ' mayc@imsweb.com'
170- }
171- developer {
172- id = ' depryf'
173- name = ' Fabian Depry'
174- email = ' depryf@imsweb.com'
175- }
176- }
177-
178- scm {
179- url = ' https://github.com/imsweb/seerapi-client-java'
180- connection = ' scm:https://github.com/imsweb/seerapi-client-java.git'
181- developerConnection = ' scm:git@github.com:imsweb/seerapi-client-java.git'
182- }
135+ licenses {
136+ license {
137+ name = ' The MIT License (MIT)'
138+ url = ' http://www.opensource.org/licenses/mit-license.php'
183139 }
184140 }
185- }
186- repositories {
187- maven {
188- def releasesRepoUrl = " https://oss.sonatype.org/service/local/staging/deploy/maven2"
189- def snapshotsRepoUrl = " https://oss.sonatype.org/content/repositories/snapshots"
190- url = version. endsWith(' SNAPSHOT' ) ? snapshotsRepoUrl : releasesRepoUrl
191-
192- credentials {
193- username = project. findProperty(' nexusUsername' ) ?: ' '
194- password = project. findProperty(' nexusPassword' ) ?: ' '
141+
142+ developers {
143+ developer {
144+ id = ' ctmay4'
145+ name = ' Chuck May'
146+ email = ' mayc@imsweb.com'
147+ }
148+ developer {
149+ id = ' depryf'
150+ name = ' Fabian Depry'
151+ email = ' depryf@imsweb.com'
195152 }
196153 }
197- }
198- }
199-
200- signing {
201- def signingKey = project. findProperty(' signingKey' ) ?: ' '
202- def signingPassword = project. findProperty(' signingPassword' ) ?: ' '
203-
204- useInMemoryPgpKeys(signingKey, signingPassword)
205154
206- sign publishing. publications. mavenJava
207- }
208-
209- javadoc {
210- if (JavaVersion . current(). isJava9Compatible()) {
211- options. addBooleanOption(' html5' , true )
155+ scm {
156+ url = ' https://github.com/imsweb/seerapi-client-java'
157+ connection = ' scm:https://github.com/imsweb/seerapi-client-java.git'
158+ developerConnection = ' scm:git@github.com:imsweb/seerapi-client-java.git'
159+ }
212160 }
213161}
214162
215- // configure nexus staging plugin
216- nexusStaging {
217- numberOfRetries = 50
218- delayBetweenRetriesInMillis = 5000
163+ wrapper {
164+ gradleVersion = ' 8.14'
165+ distributionType = Wrapper.DistributionType . ALL
219166}
0 commit comments