Skip to content

Commit 663899f

Browse files
committed
Adjust creds for nexus upload
1 parent 6078b88 commit 663899f

File tree

1 file changed

+10
-22
lines changed

1 file changed

+10
-22
lines changed

build.gradle.kts

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -450,32 +450,20 @@ publishing {
450450

451451
// Configure publication target repository
452452
repositories {
453-
// Allow CI to provide publish URLs via project properties `mavenUrl` and `mavenSnapshotUrl`.
454-
// If neither is provided, fall back to the existing BentoBox repository.
455-
val mavenUrlProp = project.findProperty("mavenUrl") as String?
456-
val mavenSnapshotUrlProp = project.findProperty("mavenSnapshotUrl") as String?
457-
458-
val publishUrl = if (version.toString().endsWith("SNAPSHOT")) mavenSnapshotUrlProp else mavenUrlProp
459-
460-
if (publishUrl != null) {
461-
maven {
462-
url = uri(publishUrl)
463-
// Optional credentials passed via project properties `mavenUsername`/`mavenPassword`
464-
val username = project.findProperty("mavenUsername") as String?
465-
val password = project.findProperty("mavenPassword") as String?
466-
if (!username.isNullOrBlank() && !password.isNullOrBlank()) {
453+
val mavenUrl: String? by project
454+
val mavenSnapshotUrl: String? by project
455+
456+
(if(version.toString().endsWith("SNAPSHOT")) mavenSnapshotUrl else mavenUrl)?.let { url ->
457+
maven(url) {
458+
val mavenUsername: String? by project
459+
val mavenPassword: String? by project
460+
if(mavenUsername != null && mavenPassword != null) {
467461
credentials {
468-
this.username = username
469-
this.password = password
462+
username = mavenUsername
463+
password = mavenPassword
470464
}
471465
}
472466
}
473-
} else {
474-
// Fallback to the existing public repository for manual publishes
475-
maven {
476-
name = "bentoboxworld"
477-
url = uri("https://repo.codemc.org/repository/bentoboxworld/") // Where artifacts are uploaded
478-
}
479467
}
480468
}
481469
}

0 commit comments

Comments
 (0)