Skip to content

Commit 7f3ba6e

Browse files
committed
fix: version detection should be wrapped with afterEvaluated
Otherwise, we'll get "unspecified" always.
1 parent f5947b4 commit 7f3ba6e

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

buildSrc/src/main/kotlin/maven-publish-convention.gradle.kts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,16 @@ publishing {
1515
repositories {
1616
maven {
1717
name = "Central"
18-
url = if (version.toString().endsWith("SNAPSHOT")) {
19-
// uri("https://s01.oss.sonatype.org/content/repositories/snapshots")
20-
uri("https://oss.sonatype.org/content/repositories/snapshots")
21-
} else {
22-
// uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2")
23-
uri("https://oss.sonatype.org/service/local/staging/deploy/maven2")
18+
afterEvaluate {
19+
url = if (version.toString().endsWith("SNAPSHOT")) {
20+
// uri("https://s01.oss.sonatype.org/content/repositories/snapshots")
21+
uri("https://oss.sonatype.org/content/repositories/snapshots")
22+
} else {
23+
// uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2")
24+
uri("https://oss.sonatype.org/service/local/staging/deploy/maven2")
25+
}
2426
}
27+
2528
credentials {
2629
username = properties["ossrhUsername"]?.toString() ?: System.getenv("OSSRH_USERNAME")
2730
password = properties["ossrhPassword"]?.toString() ?: System.getenv("OSSRH_PASSWORD")

0 commit comments

Comments
 (0)