mirror of
https://github.com/tursom/TursomServer.git
synced 2024-12-27 13:20:35 +08:00
update maven publish
This commit is contained in:
parent
28de77dc79
commit
a2455cc695
@ -18,8 +18,8 @@ ext["excludeTest"] = { project: Project, tasks: TaskContainer ->
|
||||
ext["publishRepositories"] = { project: Project, p: PublishingExtension ->
|
||||
p.repositories {
|
||||
try {
|
||||
val artifactoryUser: String by rootProject
|
||||
val artifactoryPassword: String by rootProject
|
||||
val artifactoryUser: String = rootProject.ext["tursom.artifactoryUser"] as String
|
||||
val artifactoryPassword: String = rootProject.ext["tursom.artifactoryPassword"] as String
|
||||
maven {
|
||||
val releasesRepoUrl = uri("https://nvm.tursom.cn/repository/maven-releases/")
|
||||
val snapshotRepoUrl = uri("https://nvm.tursom.cn/repository/maven-snapshots/")
|
||||
@ -30,7 +30,7 @@ ext["publishRepositories"] = { project: Project, p: PublishingExtension ->
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
System.err.println("无法将包推送到tursom仓库上")
|
||||
System.err.println("cannot push to repository tursom")
|
||||
}
|
||||
try {
|
||||
maven {
|
||||
@ -44,7 +44,35 @@ ext["publishRepositories"] = { project: Project, p: PublishingExtension ->
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
System.err.println("无法将包推送到github仓库上")
|
||||
System.err.println("cannot push to repository github")
|
||||
}
|
||||
|
||||
val repositoriesRegex = "repositories\\.[a-zA-z]*".toRegex()
|
||||
rootProject.properties.keys.asSequence().filter {
|
||||
it matches repositoriesRegex
|
||||
}.forEach {
|
||||
val repositoryName = rootProject.ext.properties["$it.name"]?.toString() ?: it.substringAfterLast('.')
|
||||
try {
|
||||
val artifactoryUser = rootProject.ext.properties["$it.artifactoryUser"].toString()
|
||||
val artifactoryPassword = rootProject.ext.properties["$it.artifactoryPassword"].toString()
|
||||
maven {
|
||||
name = repositoryName
|
||||
val releasesRepoUrl = rootProject.ext.properties["$it.release"]?.let { uri(it.toString()) }
|
||||
val snapshotRepoUrl = rootProject.ext.properties["$it.snapshot"]?.let { uri(it.toString()) }
|
||||
val repoUrl = rootProject.ext.properties["$it.url"]?.let { uri(it.toString()) }
|
||||
url = if (project.version.toString().endsWith("SNAPSHOT")
|
||||
&& snapshotRepoUrl != null
|
||||
) {
|
||||
snapshotRepoUrl
|
||||
} else releasesRepoUrl ?: repoUrl!!
|
||||
credentials {
|
||||
username = artifactoryUser
|
||||
password = artifactoryPassword
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
System.err.println("cannot push to repository $repositoryName")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user