Skip to content

Commit 1a0939e

Browse files
authored
feat(build): Include Maven POMs in all jars (#172)
1 parent ea7d920 commit 1a0939e

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

build-logic/src/main/kotlin/authmgr-maven.gradle.kts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,15 @@ publishing {
2828
}
2929
}
3030

31+
if (project.hasProperty("release")) {
32+
tasks.withType<Jar>().configureEach {
33+
from(tasks.named("generatePomFileForMavenPublication")) {
34+
include("pom-default.xml")
35+
eachFile { this.path = "META-INF/maven/${project.group}/${project.name}/pom.xml" }
36+
}
37+
}
38+
}
39+
3140
// Use afterEvaluate to ensure properties are accessed after they've been set
3241
afterEvaluate {
3342

@@ -38,11 +47,11 @@ afterEvaluate {
3847
publishing {
3948
publications {
4049

41-
// Only create staging-maven publication for projects that should be published
50+
// Only create maven publication for projects that should be published
4251
if (project.name !in excludedProjects) {
4352

4453
// This publication is used for staging and deployment to Maven Central by JReleaser
45-
create<MavenPublication>("staging-maven") {
54+
create<MavenPublication>("maven") {
4655
if (project.plugins.hasPlugin("authmgr-bundle")) {
4756
from(components["shadow"])
4857
// Shadow component doesn't include javadoc and sources jars by default, so add them

build.gradle.kts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,5 @@ tasks.named<RatTask>("rat").configure {
7272
}
7373

7474
afterEvaluate {
75-
publishing {
76-
publications { named<MavenPublication>("staging-maven") { pom { packaging = "pom" } } }
77-
}
75+
publishing { publications { named<MavenPublication>("maven") { pom { packaging = "pom" } } } }
7876
}

0 commit comments

Comments
 (0)