From fd7fb33faec969ed59d193e0346906f0377890b7 Mon Sep 17 00:00:00 2001 From: Will Sargent Date: Tue, 3 Dec 2024 21:04:13 -0800 Subject: [PATCH] Add nexus --- .github/workflows/gradle.yml | 24 ++++++++++++++++++++++ build.gradle.kts | 14 +++++++++++++ lib/build.gradle.kts | 40 +++++++++++++++++++++++++++++++++++- 3 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/gradle.yml create mode 100644 build.gradle.kts diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml new file mode 100644 index 0000000..46879f5 --- /dev/null +++ b/.github/workflows/gradle.yml @@ -0,0 +1,24 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: Java CI + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v4 + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: 17 + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + - name: Build with Gradle + run: ./gradlew build diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..481de1e --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,14 @@ + +plugins { + id("io.github.gradle-nexus.publish-plugin") version "2.0.0" +} + + +// https://github.com/gradle-nexus/publish-plugin/?tab=readme-ov-file#publishing-to-maven-central-via-sonatype-ossrh +nexusPublishing { + repositories { + // the user token is set outside the project + // https://central.sonatype.org/publish/generate-token/ + sonatype() + } +} diff --git a/lib/build.gradle.kts b/lib/build.gradle.kts index a26a6e0..3fc751d 100644 --- a/lib/build.gradle.kts +++ b/lib/build.gradle.kts @@ -8,6 +8,8 @@ plugins { // Apply the java-library plugin for API and implementation separation. `java-library` + `maven-publish` // https://docs.gradle.org/current/userguide/publishing_maven.html + signing } repositories { @@ -20,7 +22,7 @@ dependencies { testImplementation(libs.junit.jupiter) testRuntimeOnly("org.junit.platform:junit-platform-launcher") - + // This dependency is used internally, and not exposed to consumers on their own compile classpath. testImplementation(libs.logback.classic) } @@ -36,3 +38,39 @@ tasks.named("test") { // Use JUnit Platform for unit tests. useJUnitPlatform() } + +java { + withJavadocJar() + withSourcesJar() +} + +publishing { //https://docs.gradle.org/current/userguide/publishing_maven.html + publications { + create("mavenJava") { //name of the publication + from(components["java"]) + pom { + name.set("JMXBuilder") + description.set("JMXBuilder") + url.set("https://github.com/tersesystems/jmxbuilder") + licenses { + license { + name.set("Apache2") + url.set("https://github.com/tersesystems/jmxbuilder/blob/main/LICENSE") + } + } + developers { + developer { + id.set("wsargent") + name.set("Will Sargent") + email.set("will@tersesystems.com") + } + } + scm { + connection.set("scm:git:https://github.com/tersesystems/jmxbuilder.git") + developerConnection.set("scm:git:https://github.com/tersesystems/jmxbuilder.git") + url.set("https://github.com/tersesystems/jmxbuilder.git") + } + } + } + } +} \ No newline at end of file