加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
build.gradle.kts 5.27 KB
一键复制 编辑 原始数据 按行查看 历史
Ahoo-Wang 提交于 2021-12-28 22:32 . ## Update dependency
/*
* Copyright [2021-2021] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
plugins {
id("io.github.gradle-nexus.publish-plugin") version ("1.1.0")
}
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.13")
set("springCloudVersion", "2020.0.5")
set("jmhVersion", "1.29")
set("guavaVersion", "30.0-jre")
set("springfoxVersion", "3.0.0")
set("cosIdVersion", "1.6.6")
set("simbaVersion", "0.2.6")
set("shardingsphereVersion","5.0.0")
set("libraryProjects", libraryProjects)
}
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("testImplementation", "org.junit.jupiter:junit-jupiter-params")
this.add("testImplementation", "org.junit-pioneer:junit-pioneer")
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 = "GitHubPackages"
url = uri("https://maven.pkg.github.com/Ahoo-Wang/govern-eventbus")
credentials {
username = project.findProperty("gitHubPackagesUserName") as String
password = project.findProperty("gitHubPackagesToken") as String
}
}
}
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"))
}
}
}
nexusPublishing {
repositories {
sonatype()
}
}
fun getPropertyOf(name: String) = project.properties[name]?.toString()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化