build: 将 Maven 发布仓库从 Github Repo 改为自建 Nexus 仓库.

由于 Github 自建仓库在 SNAPSHOT 版本上存在问题, 故修改发布配置以转移到自建的 Nexus 仓库.
This commit is contained in:
LamGC 2022-05-17 19:03:58 +08:00
parent 95ad251826
commit a44732a7f6
Signed by: LamGC
GPG Key ID: 6C5AE2A913941E1D

View File

@ -38,24 +38,21 @@ tasks.withType<KotlinCompile> {
publishing { publishing {
repositories { repositories {
val repoRootKey = "maven.repo.local.root" if (project.version.toString().endsWith("-SNAPSHOT")) {
val snapshot = project.version.toString().endsWith("-SNAPSHOT") maven("https://repo.lamgc.moe/repository/maven-snapshots/") {
val repoRoot = System.getProperty(repoRootKey)?.trim() credentials {
if (repoRoot == null || repoRoot.isEmpty()) { username = project.properties["repo.credentials.private.username"].toString()
logger.warn( password = project.properties["repo.credentials.private.password"].toString()
"\"$repoRootKey\" configuration item is not specified, " + }
"please add start parameter \"-D$repoRootKey {localPublishRepo}\"" +
" (if you are not currently executing the publish task, " +
"you can ignore this information)"
)
return@repositories
} }
val repoUri = if (snapshot) {
uri("$repoRoot/snapshots")
} else { } else {
uri("$repoRoot/releases") maven("https://repo.lamgc.moe/repository/maven-releases/") {
credentials {
username = project.properties["repo.credentials.private.username"].toString()
password = project.properties["repo.credentials.private.password"].toString()
}
}
} }
maven(repoUri)
} }
publications { publications {