From bc903b74a2cbbf17fc83f5dd36e246745ab63b05 Mon Sep 17 00:00:00 2001 From: bobbylight Date: Fri, 2 Jan 2026 17:48:06 -0500 Subject: [PATCH] Get publishing to gradle working with gradle-nexus/publish-plugin --- AutoComplete/build.gradle | 14 +------------- build.gradle | 20 ++++++++++++++++++-- settings.gradle | 6 ++++++ 3 files changed, 25 insertions(+), 15 deletions(-) diff --git a/AutoComplete/build.gradle b/AutoComplete/build.gradle index ce58c4b..5c36004 100644 --- a/AutoComplete/build.gradle +++ b/AutoComplete/build.gradle @@ -9,7 +9,7 @@ base { } dependencies { - api 'com.fifesoft:rsyntaxtextarea:3.5.4' + api 'com.fifesoft:rsyntaxtextarea:3.6.1' } ext.isReleaseVersion = !project.version.endsWith('SNAPSHOT') @@ -29,18 +29,6 @@ jar { } publishing { - repositories { - maven { - def releasesRepoUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/' - def snapshotsRepoUrl = 'https://oss.sonatype.org/content/repositories/snapshots/' - url = isReleaseVersion ? releasesRepoUrl : snapshotsRepoUrl - credentials { // Credentials usually kept in user's .gradle/gradle.properties - // We must defensively check for these properties so CI builds work - username = project.hasProperty('ossrhToken') ? ossrhToken : 'unknown' - password = project.hasProperty('ossrhTokenPassword') ? ossrhTokenPassword : 'unknown' - } - } - } publications { maven(MavenPublication) { diff --git a/build.gradle b/build.gradle index 0e39b9c..539ea0a 100644 --- a/build.gradle +++ b/build.gradle @@ -8,9 +8,13 @@ buildscript { } plugins { - id 'com.github.spotbugs' version '6.1.3' + id 'com.github.spotbugs' version '6.1.7' + id 'io.github.gradle-nexus.publish-plugin' version '2.0.0' + } +apply plugin: 'io.github.gradle-nexus.publish-plugin' + // We require building with JDK 17 or later. Built artifact compatibility // is controlled by javaLanguageVersion assert JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_17) @@ -23,7 +27,7 @@ allprojects { repositories { mavenCentral() maven { - url = 'https://oss.sonatype.org/content/repositories/snapshots' + url = 'https://central.sonatype.com/repository/maven-snapshots/' } } @@ -90,3 +94,15 @@ subprojects { options.compilerArgs << "-Xlint:deprecation" << '-Xlint:unchecked' } } + +nexusPublishing { + repositories { + sonatype { + nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/")) + snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/")) + // We must defensively check for these properties so CI builds work + username.set(project.hasProperty('sonatypeUsername') ? sonatypeUsername : 'unknown') + password.set(project.hasProperty('sonatypePassword') ? sonatypePassword : 'unknown') + } + } +} diff --git a/settings.gradle b/settings.gradle index 4e8b8c1..a8fb36b 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,3 +1,9 @@ +pluginManagement { + repositories { + gradlePluginPortal() + } +} + rootProject.name = 'AutoComplete' include 'AutoComplete', 'AutoCompleteDemo'