Skip to content

Commit 721155e

Browse files
authored
Change jmx-metrics jar classifier so shadowJar isn't rebuilt even when nothing changed. (#231)
1 parent d6c4d9d commit 721155e

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

jmx-metrics/build.gradle.kts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,32 @@ tasks {
7474
archiveClassifier.set("")
7575
}
7676

77+
jar {
78+
archiveClassifier.set("noshadow")
79+
}
80+
7781
withType<Test>().configureEach {
7882
dependsOn(shadowJar)
7983
systemProperty("shadow.jar.path", shadowJar.get().archiveFile.get().asFile.absolutePath)
8084
systemProperty("gradle.project.version", "${project.version}")
8185
}
86+
87+
// Because we reconfigure publishing to only include the shadow jar, the Gradle metadata is not correct.
88+
// Since we are fully bundled and have no dependencies, Gradle metadata wouldn't provide any advantage over
89+
// the POM anyways so in practice we shouldn't be losing anything.
90+
withType<GenerateModuleMetadata>().configureEach {
91+
enabled = false
92+
}
93+
}
94+
95+
// Don't publish non-shadowed jar (shadowJar is in shadowRuntimeElements)
96+
with(components["java"] as AdhocComponentWithVariants) {
97+
configurations.forEach {
98+
withVariantsFromConfiguration(configurations["apiElements"]) {
99+
skip()
100+
}
101+
withVariantsFromConfiguration(configurations["runtimeElements"]) {
102+
skip()
103+
}
104+
}
82105
}

0 commit comments

Comments
 (0)