-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
121 lines (96 loc) · 4.21 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
121 lines (96 loc) · 4.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
import net.researchgate.release.ReleaseExtension
plugins {
`maven-publish`
signing
id("io.github.gradle-nexus.publish-plugin") version "2.0.0" // nexus publish/close/release
id("net.researchgate.release") version "3.1.0"
}
allprojects {
group = "org.openprojectx.spring.cloud.proxy"
}
subprojects {
tasks.register<DependencyReportTask>("allDependencies") {}
// Apply to every module (safe even if a module doesn't publish)
apply(plugin = "maven-publish")
apply(plugin = "signing")
// Configure publishing only when the project has a Java component (Kotlin/JVM typically applies java too)
plugins.withId("java") {
// ✅ Ensure required artifacts exist for Maven Central
extensions.configure<JavaPluginExtension>("java") {
withSourcesJar()
withJavadocJar()
}
// Kotlin-only modules can produce "empty-ish" Javadoc; don't fail the build on doclint/errors
tasks.withType(Javadoc::class.java).configureEach {
isFailOnError = false
}
extensions.configure<PublishingExtension>("publishing") {
publications {
// Create once per project
if (findByName("mavenJava") == null) {
create<MavenPublication>("mavenJava") {
from(components["java"])
// Prefer explicit artifactId; by default it's project.name
artifactId = project.name
pom {
// Module-specific name/description; override per-module if you want
name.set(project.name)
description.set("SPRING-CLOUD-PROXY Spring Boot starter")
url.set("https://github.com/OpenProjectX/spring-cloud-proxy")
licenses {
license {
name.set("Apache License 2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0")
}
}
developers {
developer {
id.set("OpenProjectX")
name.set("OpenProjectX")
email.set("admin@openprojectx.org")
}
}
scm {
url.set("https://github.com/OpenProjectX/spring-cloud-proxy")
connection.set("scm:git:https://github.com/OpenProjectX/spring-cloud-proxy.git")
developerConnection.set("scm:git:ssh://git@github.com:OpenProjectX/spring-cloud-proxy.git")
}
}
}
}
}
}
}
// Signing: only configure keys if provided (keeps local dev painless)
extensions.configure<SigningExtension>("signing") {
val keyFile = System.getenv("SIGNING_KEY_FILE")
val keyPass = System.getenv("SIGNING_KEY_PASSWORD")
if (!keyFile.isNullOrBlank()) {
val keyText = file(keyFile).readText()
useInMemoryPgpKeys(keyText, keyPass)
// Sign all publications created in this subproject
val publishing = extensions.findByType(PublishingExtension::class.java)
if (publishing != null) {
sign(publishing.publications)
}
}
}
}
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
username.set(System.getenv("OSSRH_USERNAME"))
password.set(System.getenv("OSSRH_PASSWORD"))
}
}
}
configure<ReleaseExtension> {
buildTasks.set(listOf("publishToSonatype", "closeAndReleaseSonatypeStagingRepository"))
versionPropertyFile.set("gradle.properties")
tagTemplate.set("\$name-\$version")
with(git) {
requireBranch.set("master")
}
}