Skip to content

Commit 35c0b7d

Browse files
authored
Fix publishing plugin configuration (#5)
1 parent e1e6605 commit 35c0b7d

File tree

1 file changed

+46
-33
lines changed

1 file changed

+46
-33
lines changed

build.gradle.kts

Lines changed: 46 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import com.vanniktech.maven.publish.MavenPublishBaseExtension
1+
import com.vanniktech.maven.publish.JavaLibrary
22
import com.vanniktech.maven.publish.SonatypeHost
33
import com.diffplug.gradle.spotless.SpotlessExtension
4+
import com.vanniktech.maven.publish.JavadocJar
45
import net.ltgt.gradle.errorprone.CheckSeverity
56
import net.ltgt.gradle.errorprone.errorprone
67

@@ -9,6 +10,7 @@ plugins {
910

1011
`java-library`
1112
alias(libs.plugins.errorprone.plugin)
13+
id("com.vanniktech.maven.publish.base") version "0.25.3"
1214
}
1315

1416
java {
@@ -66,42 +68,53 @@ allprojects {
6668
}
6769
}
6870

69-
apply(plugin = "com.vanniktech.maven.publish.base")
70-
plugins.withId("com.vanniktech.maven.publish.base") {
71-
configure<MavenPublishBaseExtension> {
72-
val isAutoReleased = project.hasProperty("signingInMemoryKey")
73-
publishToMavenCentral(SonatypeHost.S01)
74-
if (isAutoReleased) {
75-
signAllPublications()
76-
}
77-
pom {
78-
description.set("Protocol Buffer Validation")
79-
name.set("protovalidate") // This is overwritten in subprojects.
80-
group = "build.buf"
81-
val releaseVersion = project.findProperty("releaseVersion") as String? ?: System.getenv("VERSION")
82-
// Default to snapshot versioning for local publishing.
83-
version = releaseVersion ?: "0.0.0-SNAPSHOT"
84-
url.set("https://github.com/bufbuild/protovalidate-java")
85-
licenses {
86-
license {
87-
name.set("The Apache Software License, Version 2.0")
88-
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
89-
distribution.set("repo")
90-
}
91-
}
92-
developers {
93-
developer {
94-
id.set("bufbuild")
95-
name.set("Buf Technologies")
96-
}
71+
mavenPublishing {
72+
val isAutoReleased = project.hasProperty("signingInMemoryKey")
73+
publishToMavenCentral(SonatypeHost.S01)
74+
if (isAutoReleased) {
75+
signAllPublications()
76+
}
77+
val releaseVersion = project.findProperty("releaseVersion") as String? ?: System.getenv("VERSION")
78+
coordinates("build.buf", "protovalidate", releaseVersion ?: "0.0.0-SNAPSHOT")
79+
pomFromGradleProperties()
80+
configure(JavaLibrary(
81+
// configures the -javadoc artifact, possible values:
82+
// - `JavadocJar.None()` don't publish this artifact
83+
// - `JavadocJar.Empty()` publish an emprt jar
84+
// - `JavadocJar.Javadoc()` to publish standard javadocs
85+
javadocJar = JavadocJar.Javadoc(),
86+
// whether to publish a sources jar
87+
sourcesJar = true,
88+
)
89+
)
90+
pom {
91+
name.set("connect-library") // This is overwritten in subprojects.
92+
group = "build.buf"
93+
val releaseVersion = project.findProperty("releaseVersion") as String?
94+
// Default to snapshot versioning for local publishing.
95+
version = releaseVersion ?: "0.0.0-SNAPSHOT"
96+
description.set("Protocol Buffer Validation")
97+
url.set("https://github.com/bufbuild/protovalidate-java")
98+
licenses {
99+
license {
100+
name.set("The Apache Software License, Version 2.0")
101+
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
102+
distribution.set("repo")
97103
}
98-
scm {
99-
url.set("https://github.com/bufbuild/protovalidate-java")
100-
connection.set("scm:git:https://github.com/bufbuild/protovalidate-java.git")
101-
developerConnection.set("scm:git:ssh://[email protected]/bufbuild/protovalidate-java.git")
104+
}
105+
developers {
106+
developer {
107+
id.set("bufbuild")
108+
name.set("Buf Technologies")
102109
}
103110
}
111+
scm {
112+
url.set("https://github.com/bufbuild/protovalidate-java")
113+
connection.set("scm:git:https://github.com/bufbuild/protovalidate-java.git")
114+
developerConnection.set("scm:git:ssh://[email protected]/bufbuild/protovalidate-java.git")
115+
}
104116
}
117+
105118
}
106119

107120
dependencies {

0 commit comments

Comments
 (0)