1+ import com.vanniktech.maven.publish.DeploymentValidation
2+
13plugins {
24 id(" pmd" )
35 alias(libs.plugins.spotless)
@@ -91,6 +93,10 @@ spotless {
9193 }
9294}
9395
96+ val pmdVersion = libs.versions.pmd.get()
97+
98+ extensions.configure< org.gradle.api.plugins.quality.PmdExtension > { toolVersion = pmdVersion }
99+
94100subprojects {
95101 apply (plugin = " java" )
96102 apply (plugin = " pmd" )
@@ -99,7 +105,7 @@ subprojects {
99105
100106 // PMD configuration
101107 extensions.configure< org.gradle.api.plugins.quality.PmdExtension > {
102- toolVersion = " 7.16.0 "
108+ toolVersion = pmdVersion
103109 ruleSets = listOf () // disable defaults
104110 ruleSetFiles = files(" ${rootDir} /config/pmd/ruleset.xml" )
105111 isConsoleOutput = true
@@ -133,17 +139,11 @@ subprojects {
133139
134140 tasks.withType< com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask > {
135141 rejectVersionIf {
136- val isUnstable =
142+ fun isUnstable ( version : String ) =
137143 listOf (" alpha" , " beta" , " rc" , " cr" , " m" , " preview" , " b" , " ea" ).any { qualifier ->
138- candidate. version.lowercase().contains(qualifier)
144+ version.lowercase().contains(qualifier)
139145 }
140-
141- val isStable =
142- listOf (" release" , " final" , " ga" ).any { qualifier ->
143- currentVersion.lowercase().contains(qualifier)
144- }
145-
146- isUnstable && ! isStable
146+ isUnstable(candidate.version) && ! isUnstable(currentVersion)
147147 }
148148 }
149149
@@ -154,9 +154,12 @@ subprojects {
154154 targetCompatibility = JavaVersion .VERSION_17
155155 }
156156
157- // Allow the compiler to see higher-version APIs for reflection but keep the bytecode target at
158- // 17.
159- tasks.withType<JavaCompile > { options.release.set(17 ) }
157+ tasks.withType<JavaCompile > {
158+ options.release.set(17 )
159+ options.compilerArgs.addAll(
160+ listOf (" -Xlint:unchecked" , " -Xlint:deprecation" , " -Xlint:rawtypes" , " -Werror" )
161+ )
162+ }
160163
161164 // use the environment's JDK instead of the toolchain's JDK for tests
162165 tasks.withType<Test > { javaLauncher.set(null as JavaLauncher ? ) }
@@ -213,4 +216,49 @@ subprojects {
213216 }
214217 }
215218 }
219+
220+ plugins.withId(" com.vanniktech.maven.publish" ) {
221+ val publishingToMavenCentral =
222+ gradle.startParameter.taskNames.any { it.contains(" publishToMavenCentral" ) }
223+
224+ tasks.withType<Javadoc > {
225+ (options as StandardJavadocDocletOptions ).apply {
226+ addStringOption(" Xdoclint:all,-missing" , " -quiet" )
227+ encoding = " UTF-8"
228+ }
229+ }
230+
231+ tasks.named(" build" ) { dependsOn(" javadoc" ) }
232+
233+ extensions.configure< com.vanniktech.maven.publish.MavenPublishBaseExtension > {
234+ publishToMavenCentral(automaticRelease = true , validateDeployment = DeploymentValidation .NONE )
235+ if (publishingToMavenCentral) signAllPublications()
236+
237+ pom {
238+ inceptionYear.set(" 2025" )
239+ url.set(" https://github.com/dbos-inc/dbos-transact-java" )
240+
241+ licenses {
242+ license {
243+ name.set(" MIT License" )
244+ url.set(" https://opensource.org/licenses/MIT" )
245+ }
246+ }
247+
248+ developers {
249+ developer {
250+ id.set(" dbos-inc" )
251+ name.set(" DBOS Inc" )
252+ email.set(" support@dbos.dev" )
253+ }
254+ }
255+
256+ scm {
257+ connection.set(" scm:git:git://github.com/dbos-inc/dbos-transact-java.git" )
258+ developerConnection.set(" scm:git:ssh://github.com:dbos-inc/dbos-transact-java.git" )
259+ url.set(" https://github.com/dbos-inc/dbos-transact-java/tree/main" )
260+ }
261+ }
262+ }
263+ }
216264}
0 commit comments