|
1 | 1 | plugins { |
2 | 2 | id "java-library" |
3 | 3 | id "maven-publish" |
4 | | - id "signing" |
| 4 | + id "org.jreleaser" version "1.22.0" |
5 | 5 | id "com.diffplug.spotless" version "6.25.0" |
6 | 6 | } |
7 | 7 |
|
@@ -65,6 +65,8 @@ compileIntegrationTestJava { |
65 | 65 | options.compilerArgs << "-parameters" |
66 | 66 | } |
67 | 67 |
|
| 68 | +def stagingDir = layout.buildDirectory.dir("staging-deploy") |
| 69 | + |
68 | 70 | publishing { |
69 | 71 | publications { |
70 | 72 | mavenJava(MavenPublication) { |
@@ -97,35 +99,30 @@ publishing { |
97 | 99 | } |
98 | 100 | repositories { |
99 | 101 | maven { |
100 | | - url = uri(project.version.toString().endsWith("-SNAPSHOT") ? |
101 | | - "https://oss.sonatype.org/content/repositories/snapshots/" : |
102 | | - "https://oss.sonatype.org/service/local/staging/deploy/maven2/") |
103 | | - credentials { |
104 | | - username = project.hasProperty("ossrhUsername") ? |
105 | | - project.property("ossrhUsername").toString() : "" |
106 | | - password = project.hasProperty("ossrhPassword") ? |
107 | | - project.property("ossrhPassword").toString() : "" |
108 | | - } |
| 102 | + name = "staging" |
| 103 | + url = uri(stagingDir) |
109 | 104 | } |
110 | 105 | } |
111 | 106 | } |
112 | 107 |
|
113 | | -signing { |
114 | | - if (project.hasProperty("signing.gnupg.keyName")) { |
115 | | - setRequired(true) |
116 | | - } |
117 | | - else if (project.hasProperty("signingKey")) { |
118 | | - // def signingKeyId = project.property("signingKeyId").toString() |
119 | | - def signingKey = project.property("signingKey").toString() |
120 | | - def signingPassword = project.property("signingPassword").toString() |
121 | | - // useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword) |
122 | | - useInMemoryPgpKeys(signingKey, signingPassword) |
123 | | - setRequired(true) |
| 108 | +jreleaser { |
| 109 | + signing { |
| 110 | + pgp { |
| 111 | + active = 'ALWAYS' |
| 112 | + armored = true |
| 113 | + } |
124 | 114 | } |
125 | | - else { |
126 | | - setRequired(false) |
| 115 | + deploy { |
| 116 | + maven { |
| 117 | + mavenCentral { |
| 118 | + sonatype { |
| 119 | + active = 'RELEASE' |
| 120 | + url = 'https://central.sonatype.com/api/v1/publisher' |
| 121 | + stagingRepository(stagingDir.get().asFile.path) |
| 122 | + } |
| 123 | + } |
| 124 | + } |
127 | 125 | } |
128 | | - sign publishing.publications.mavenJava |
129 | 126 | } |
130 | 127 |
|
131 | 128 | spotless { |
|
0 commit comments