加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
build.gradle.kts 4.50 KB
一键复制 编辑 原始数据 按行查看 历史
Ahoo-Wang 提交于 2021-05-09 00:37 . # Govern EventBus
plugins {
id("io.codearte.nexus-staging")
}
val bomProjects = listOf(
project(":eventbus-bom"),
project(":eventbus-dependencies")
)
val demoProject = project(":eventbus-demo")
val publishProjects = subprojects - demoProject
val libraryProjects = subprojects - bomProjects
ext {
set("lombokVersion", "1.18.20")
set("springBootVersion", "2.4.5")
set("springCloudVersion", "2020.0.2")
set("jmhVersion", "1.29")
set("guavaVersion", "30.0-jre")
set("springfoxVersion", "3.0.0")
}
allprojects {
repositories {
mavenLocal()
mavenCentral()
}
}
configure(bomProjects) {
apply<JavaPlatformPlugin>()
configure<JavaPlatformExtension> {
allowDependencies()
}
}
configure(libraryProjects) {
apply<JavaLibraryPlugin>()
configure<JavaPluginExtension> {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
}
withJavadocJar()
withSourcesJar()
}
tasks.withType<Test> {
useJUnitPlatform()
}
dependencies {
val depLombok = "org.projectlombok:lombok:${rootProject.ext.get("lombokVersion")}"
this.add("api", platform(project(":eventbus-dependencies")))
this.add("compileOnly", depLombok)
this.add("annotationProcessor", depLombok)
this.add("testCompileOnly", depLombok)
this.add("testAnnotationProcessor", depLombok)
this.add("implementation", "com.google.guava:guava")
this.add("implementation", "org.slf4j:slf4j-api")
this.add("testImplementation", "ch.qos.logback:logback-classic")
this.add("testImplementation", "org.junit.jupiter:junit-jupiter-api")
this.add("testRuntimeOnly", "org.junit.jupiter:junit-jupiter-engine")
}
}
configure(publishProjects) {
val isBom = bomProjects.contains(this)
apply<MavenPublishPlugin>()
apply<SigningPlugin>()
configure<PublishingExtension> {
repositories {
maven {
name = "projectBuildRepo"
url = uri(layout.buildDirectory.dir("repos"))
}
maven {
name = "sonatypeRepo"
url = if (version.toString().endsWith("SNAPSHOT"))
uri("https://oss.sonatype.org/content/repositories/snapshots")
else
uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials {
username = getPropertyOf("ossrhUsername")
password = getPropertyOf("ossrhPassword")
}
}
}
publications {
val publishName = if (isBom) "mavenBom" else "mavenLibrary"
val publishComponentName = if (isBom) "javaPlatform" else "java"
create<MavenPublication>(publishName) {
from(components[publishComponentName])
pom {
name.set(rootProject.name)
description.set(getPropertyOf("description"))
url.set(getPropertyOf("website"))
issueManagement {
system.set("GitHub")
url.set(getPropertyOf("issues"))
}
scm {
url.set(getPropertyOf("website"))
connection.set(getPropertyOf("vcs"))
}
licenses {
license {
name.set(getPropertyOf("license_name"))
url.set(getPropertyOf("license_url"))
distribution.set("repo")
}
}
developers {
developer {
id.set("ahoo-wang")
name.set("ahoo wang")
organization {
url.set(getPropertyOf("website"))
}
}
}
}
}
}
}
configure<SigningExtension> {
if (isBom) {
sign(extensions.getByType(PublishingExtension::class).publications.get("mavenBom"))
} else {
sign(extensions.getByType(PublishingExtension::class).publications.get("mavenLibrary"))
}
}
}
nexusStaging {
username = getPropertyOf("ossrhUsername")
password = getPropertyOf("ossrhPassword")
packageGroup = "me.ahoo"
}
fun getPropertyOf(name: String) = project.properties[name]?.toString()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化