Skip to content

Commit

Permalink
Add nexus
Browse files Browse the repository at this point in the history
  • Loading branch information
wsargent committed Dec 4, 2024
1 parent 6ac68b4 commit fd7fb33
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 1 deletion.
24 changes: 24 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -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
14 changes: 14 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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()
}
}
40 changes: 39 additions & 1 deletion lib/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)
}
Expand All @@ -36,3 +38,39 @@ tasks.named<Test>("test") {
// Use JUnit Platform for unit tests.
useJUnitPlatform()
}

java {
withJavadocJar()
withSourcesJar()
}

publishing { //https://docs.gradle.org/current/userguide/publishing_maven.html
publications {
create<MavenPublication>("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")
}
}
}
}
}

0 comments on commit fd7fb33

Please sign in to comment.