@@ -3,52 +3,65 @@ import org.gradle.api.publish.maven.MavenPublication
3
3
import org.gradle.kotlin.dsl.configure
4
4
import org.gradle.kotlin.dsl.register
5
5
import org.gradle.kotlin.dsl.get
6
- import com.vanniktech.maven.publish.JavaLibrary
7
- import com.vanniktech.maven.publish.JavadocJar
8
- import com.vanniktech.maven.publish.MavenPublishBaseExtension
9
- import com.vanniktech.maven.publish.SonatypeHost
10
6
11
7
plugins {
12
- id(" com.vanniktech.maven.publish" )
8
+ `maven- publish`
9
+ `signing`
13
10
}
14
11
15
- repositories {
16
- gradlePluginPortal()
17
- mavenCentral()
18
- }
12
+ configure< PublishingExtension > {
13
+ publications {
14
+ register< MavenPublication >( " maven " ) {
15
+ from(components[ " java " ])
19
16
20
- extra[" signingInMemoryKey" ] = System .getenv(" GPG_SIGNING_KEY" )
21
- extra[" signingInMemoryKeyId" ] = System .getenv(" GPG_SIGNING_KEY_ID" )
22
- extra[" signingInMemoryKeyPassword" ] = System .getenv(" GPG_SIGNING_PASSWORD" )
17
+ pom {
18
+ name.set(" Openlayer API" )
19
+ description.set(" API for interacting with the Openlayer server." )
20
+ url.set(" https://openlayer.com/docs/api-reference/rest/overview" )
23
21
24
- configure<MavenPublishBaseExtension > {
25
- signAllPublications()
26
- publishToMavenCentral(SonatypeHost .CENTRAL_PORTAL )
22
+ licenses {
23
+ license {
24
+ name.set(" Apache-2.0" )
25
+ }
26
+ }
27
27
28
- this .coordinates(project.group.toString(), project.name, project.version.toString())
28
+ developers {
29
+ developer {
30
+ name.set(" Openlayer" )
31
+
32
+ }
33
+ }
29
34
30
- pom {
31
- name.set(" Openlayer API" )
32
- description.set(" API for interacting with the Openlayer server." )
33
- url.set(" https://openlayer.com/docs/api-reference/rest/overview" )
35
+ scm {
36
+ connection.set(" scm:git:git://github.com/openlayer-ai/openlayer-java.git" )
37
+ developerConnection.set(" scm:git:git://github.com/openlayer-ai/openlayer-java.git" )
38
+ url.set(" https://github.com/openlayer-ai/openlayer-java" )
39
+ }
34
40
35
- licenses {
36
- license {
37
- name.set(" Apache-2.0" )
38
- }
39
- }
40
-
41
- developers {
42
- developer {
43
- name.set(" Openlayer" )
44
-
41
+ versionMapping {
42
+ allVariants {
43
+ fromResolutionResult()
44
+ }
45
+ }
45
46
}
46
47
}
48
+ }
49
+ }
47
50
48
- scm {
49
- connection.set(" scm:git:git://github.com/openlayer-ai/openlayer-java.git" )
50
- developerConnection.set(" scm:git:git://github.com/openlayer-ai/openlayer-java.git" )
51
- url.set(" https://github.com/openlayer-ai/openlayer-java" )
52
- }
51
+ signing {
52
+ val signingKeyId = System .getenv(" GPG_SIGNING_KEY_ID" )?.ifBlank { null }
53
+ val signingKey = System .getenv(" GPG_SIGNING_KEY" )?.ifBlank { null }
54
+ val signingPassword = System .getenv(" GPG_SIGNING_PASSWORD" )?.ifBlank { null }
55
+ if (signingKey != null && signingPassword != null ) {
56
+ useInMemoryPgpKeys(
57
+ signingKeyId,
58
+ signingKey,
59
+ signingPassword,
60
+ )
61
+ sign(publishing.publications[" maven" ])
53
62
}
54
63
}
64
+
65
+ tasks.named(" publish" ) {
66
+ dependsOn(" :closeAndReleaseSonatypeStagingRepository" )
67
+ }
0 commit comments