Skip to content

Commit ea8f910

Browse files
michalharakalclaude
andcommitted
build: fail fast when a published module is missing POM_ARTIFACT_ID/POM_NAME
Recurring pain: a new gradle module without its gradle.properties publishes wrong coordinates (artifactId defaults to the bare project name, not skainet-transformers-*) and/or fails at the Maven Central deploy (POM_NAME required) — discovered only at release/publish time. The bom-coverage plugin already iterates every published subproject (to build the BOM constraints), so add a configuration-time check there: each published module must set POM_ARTIFACT_ID + POM_NAME, else throw a clear GradleException naming the module + the fix. Now any build touching :llm-bom (i.e. CI) catches a forgotten gradle.properties immediately. Verified: passes with the file, fails with a precise message without it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 6c548d7 commit ea8f910

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

buildSrc/src/main/kotlin/sk/ainet/transformers/gradle/BomCoveragePlugin.kt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,28 @@ class BomCoveragePlugin : Plugin<Project> {
3737
)
3838
}
3939

40+
// Fail fast (at configuration time, not at Maven Central deploy time) when a NEW published
41+
// module forgot its gradle.properties. Without POM_ARTIFACT_ID the artifact silently defaults
42+
// to the bare project name (wrong coordinates / not the skainet-transformers-* convention);
43+
// without POM_NAME, Maven Central rejects the deploy. This recurs on every new module — catch it.
44+
val pomProblems = publishedPaths.mapNotNull { path ->
45+
val p = project.project(path)
46+
val missing = buildList {
47+
if (p.findProperty("POM_ARTIFACT_ID")?.toString().isNullOrBlank()) add("POM_ARTIFACT_ID")
48+
if (p.findProperty("POM_NAME")?.toString().isNullOrBlank()) add("POM_NAME")
49+
}
50+
if (missing.isEmpty()) null else "$path — missing ${missing.joinToString(" + ")}"
51+
}
52+
if (pomProblems.isNotEmpty()) {
53+
throw GradleException(
54+
"[bom-coverage] Published module(s) are missing required POM properties — the Maven " +
55+
"Central deploy would fail:\n" +
56+
pomProblems.joinToString("\n") { " - $it" } +
57+
"\nAdd a `gradle.properties` to each module with POM_ARTIFACT_ID + POM_NAME " +
58+
"(see `llm-core/gradle.properties`)."
59+
)
60+
}
61+
4062
project.dependencies.constraints {
4163
publishedPaths.forEach { add("api", project.project(it)) }
4264
}

0 commit comments

Comments
 (0)