|
| 1 | +import com.vanniktech.maven.publish.SonatypeHost |
| 2 | + |
1 | 3 | plugins { |
2 | 4 | `java-library` |
3 | 5 | jacoco |
4 | 6 | alias(libs.plugins.spotless) |
5 | 7 | alias(libs.plugins.vanniktech.publish) |
6 | 8 | } |
7 | 9 |
|
8 | | -group = "com.marketdata" |
9 | | -version = "0.1.0-SNAPSHOT" |
| 10 | +// Maven groupId = the verified Central Portal namespace (domain marketdata.app, |
| 11 | +// reversed). Independent of the Java package, which stays com.marketdata.sdk. |
| 12 | +group = "app.marketdata" |
| 13 | + |
| 14 | +// Version is overridable from the command line so a manual Central Portal |
| 15 | +// validation run can use a real release version (e.g. `-PsdkVersion=0.1.0`) |
| 16 | +// without committing it. Default stays on the in-development SNAPSHOT. |
| 17 | +version = (findProperty("sdkVersion") as String?) ?: "0.1.0-SNAPSHOT" |
10 | 18 |
|
11 | 19 | // ADR-002: minimum JDK 17, build with --release 17, single bytecode level. |
12 | 20 | java { |
@@ -174,13 +182,46 @@ spotless { |
174 | 182 | } |
175 | 183 |
|
176 | 184 | // ADR-003 / requirements §15: Maven Central publishing via Vanniktech. |
177 | | -// Coordinates and POM metadata below are placeholders — fill in before |
178 | | -// the first publication. |
| 185 | +// |
| 186 | +// Publishes to the Sonatype Central Portal (central.sonatype.com). |
| 187 | +// `automaticRelease = false` uploads the deployment but leaves it in the |
| 188 | +// VALIDATED state for manual review/release (or drop) from the portal UI — |
| 189 | +// the safe path for a first manual validation run. |
| 190 | +// |
| 191 | +// Upload + signing credentials are read from Gradle properties / env vars by |
| 192 | +// the plugin (never hard-coded here): |
| 193 | +// - ORG_GRADLE_PROJECT_mavenCentralUsername / _mavenCentralPassword |
| 194 | +// - ORG_GRADLE_PROJECT_signingInMemoryKey / _signingInMemoryKeyPassword |
| 195 | +// (optionally _signingInMemoryKeyId) |
179 | 196 | mavenPublishing { |
| 197 | + publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, automaticRelease = false) |
| 198 | + signAllPublications() |
| 199 | + |
180 | 200 | coordinates(group.toString(), "marketdata-sdk-java", version.toString()) |
181 | 201 | pom { |
182 | 202 | name.set("Market Data Java SDK") |
183 | 203 | description.set("Java SDK for the Market Data API.") |
184 | | - // TODO: set url, scm, license, developers before publishing. |
| 204 | + url.set("https://github.com/MarketDataApp/sdk-java") |
| 205 | + inceptionYear.set("2026") |
| 206 | + |
| 207 | + licenses { |
| 208 | + license { |
| 209 | + name.set("MIT License") |
| 210 | + url.set("https://github.com/MarketDataApp/sdk-java/blob/main/LICENSE") |
| 211 | + distribution.set("repo") |
| 212 | + } |
| 213 | + } |
| 214 | + developers { |
| 215 | + developer { |
| 216 | + id.set("marketdata") |
| 217 | + name.set("Market Data") |
| 218 | + url.set("https://www.marketdata.app") |
| 219 | + } |
| 220 | + } |
| 221 | + scm { |
| 222 | + url.set("https://github.com/MarketDataApp/sdk-java") |
| 223 | + connection.set("scm:git:git://github.com/MarketDataApp/sdk-java.git") |
| 224 | + developerConnection.set("scm:git:ssh://git@github.com/MarketDataApp/sdk-java.git") |
| 225 | + } |
185 | 226 | } |
186 | 227 | } |
0 commit comments