diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 101d49b..72fe4c5 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -19,11 +19,11 @@ jobs: uses: actions/setup-java@v3 with: distribution: 'adopt' - java-version: '17' + java-version: '21' cache: 'gradle' - name: Cache SonarCloud packages - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.sonar/cache key: ${{ runner.os }}-sonar diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index b9a18c4..3977563 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -21,15 +21,15 @@ jobs: uses: actions/setup-java@v3 with: distribution: 'adopt' - java-version: '17' + java-version: '21' cache: 'gradle' - - name: Publish + - name: Publish to Maven Central (Portal) run: | chmod +x gradlew - ./gradlew publish closeAndReleaseRepository + ./gradlew publishAndReleaseToMavenCentral --no-configuration-cache env: - ORG_GRADLE_PROJECT_nexusUsername: ${{ secrets.NEXUS_USERNAME }} - ORG_GRADLE_PROJECT_nexusPassword: ${{ secrets.NEXUS_PASSWORD }} - ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SEER_GPG_SECRET_KEY }} - ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SEER_GPG_PASSWORD }} + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} diff --git a/build.gradle b/build.gradle index 1f8f442..a7722cf 100644 --- a/build.gradle +++ b/build.gradle @@ -1,32 +1,31 @@ +import com.vanniktech.maven.publish.JavaLibrary +import com.vanniktech.maven.publish.JavadocJar +import com.vanniktech.maven.publish.SonatypeHost + plugins { id 'java-library' id 'checkstyle' id 'jacoco' - id "com.github.spotbugs" version "5.0.14" - id 'maven-publish' - id 'signing' - id "io.codearte.nexus-staging" version "0.30.0" // logs into Sonotype OSS and does a "Close" and "Release" + id "com.github.spotbugs" version '6.1.11' id 'com.adarshr.test-logger' version '4.0.0' - id "com.github.ben-manes.versions" version "0.51.0" - id 'org.sonatype.gradle.plugins.scan' version '2.8.3' - id "org.sonarqube" version "5.1.0.4882" + id "com.github.ben-manes.versions" version '0.52.0' + id 'org.sonatype.gradle.plugins.scan' version '3.1.1' + id "org.sonarqube" version '6.1.0.5360' + id 'com.vanniktech.maven.publish' version '0.31.0' } group = 'com.imsweb' -version = '1.15' +version = '1.16-SNAPSHOT' description = 'Java client library for parsing x12 files' -tasks.withType(JavaCompile) { - options.encoding = 'UTF-8' // UTF-8 for all compilation tasks - options.compilerArgs << "-Xlint:all" << "-Werror" // fail the build if there are compiler warnings +tasks.withType(JavaCompile).configureEach { + options.encoding = 'UTF-8' + options.compilerArgs << "-Werror" << "-Xlint:-options" } java { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 - - withJavadocJar() - withSourcesJar() } repositories { @@ -34,19 +33,23 @@ repositories { } dependencies { - api 'com.thoughtworks.xstream:xstream:1.4.20' + api 'com.thoughtworks.xstream:xstream:1.4.21' - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.11.0' - testImplementation 'org.junit.jupiter:junit-jupiter-params:5.11.0' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.11.0' - testImplementation 'commons-io:commons-io:2.16.1' - testImplementation 'org.jsoup:jsoup:1.18.1' + testImplementation platform('org.junit:junit-bom:5.12.2') + testImplementation 'org.junit.jupiter:junit-jupiter-api' + testImplementation 'org.junit.jupiter:junit-jupiter-params' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' + testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.12.2' + + testImplementation 'commons-io:commons-io:2.19.0' + testImplementation 'org.jsoup:jsoup:1.20.1' testImplementation 'com.jayway.jsonpath:json-path:2.9.0' } jar { manifest { - attributes('Implementation-Title': project.name, + attributes( + 'Implementation-Title': project.name, 'Implementation-Version': archiveVersion, 'Implementation-Vendor': group, 'Created-By': System.properties['java.vm.version'] + ' (' + System.properties['java.vm.vendor'] + ')', @@ -107,83 +110,6 @@ dependencyUpdates { } } -// don't try to release a snapshot to a non-snapshot repository, that won't work anyway -if (version.endsWith('-SNAPSHOT')) { - gradle.startParameter.excludedTaskNames += 'signMavenJavaPublication' - gradle.startParameter.excludedTaskNames += 'closeAndReleaseRepository' -} - -publishing { - publications { - mavenJava(MavenPublication) { - artifactId = 'x12-parser' - from components.java - versionMapping { - usage('java-api') { - fromResolutionOf('runtimeClasspath') - } - usage('java-runtime') { - fromResolutionResult() - } - } - pom { - name = 'X12 Parser' - description = 'A Java library for parsing X12 files, including ANSI 837' - url = 'https://github.com/imsweb/x12-parser' - inceptionYear = '2015' - - licenses { - license { - name = 'A modified BSD License (BSD)' - url = 'https://github.com/imsweb/x12-parser/blob/master/LICENSE' - distribution = 'repo' - } - } - - developers { - developer { - id = 'AngelaszekD' - name = 'David Angelaszek' - email = 'AngelaszekD@imsweb.com' - } - developer { - id = 'ctmay4' - name = 'Chuck May' - email = 'mayc@imsweb.com' - } - } - - scm { - url = 'https://github.com/imsweb/x12-parser' - connection = 'scm:https://github.com/imsweb/x12-parser.git' - developerConnection = 'scm:git@github.com:imsweb/x12-parser.git' - } - } - } - } - repositories { - maven { - def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2" - def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots" - url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl - - credentials { - username = project.findProperty('nexusUsername') ?: '' - password = project.findProperty('nexusPassword') ?: '' - } - } - } -} - -signing { - def signingKey = project.findProperty('signingKey') ?: '' - def signingPassword = project.findProperty('signingPassword') ?: '' - - useInMemoryPgpKeys(signingKey, signingPassword) - - sign publishing.publications.mavenJava -} - javadoc { if (JavaVersion.current().isJava9Compatible()) { options.addBooleanOption('html5', true) @@ -191,13 +117,48 @@ javadoc { } } -// configure nexus staging plugin -nexusStaging { - numberOfRetries = 50 - delayBetweenRetriesInMillis = 5000 +mavenPublishing { + configure(new JavaLibrary(new JavadocJar.Javadoc(), true)) + + publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, true) + signAllPublications() + + pom { + name = 'X12 Parser' + description = 'A Java library for parsing X12 files, including ANSI 837' + url = 'https://github.com/imsweb/x12-parser' + inceptionYear = '2015' + + licenses { + license { + name = 'A modified BSD License (BSD)' + url = 'https://github.com/imsweb/x12-parser/blob/master/LICENSE' + distribution = 'repo' + } + } + + developers { + developer { + id = 'AngelaszekD' + name = 'David Angelaszek' + email = 'AngelaszekD@imsweb.com' + } + developer { + id = 'ctmay4' + name = 'Chuck May' + email = 'mayc@imsweb.com' + } + } + + scm { + url = 'https://github.com/imsweb/x12-parser' + connection = 'scm:https://github.com/imsweb/x12-parser.git' + developerConnection = 'scm:git@github.com:imsweb/x12-parser.git' + } + } } wrapper { - gradleVersion = '8.10' + gradleVersion = '8.14' distributionType = Wrapper.DistributionType.ALL } diff --git a/config/spotbugs/spotbugs-exclude.xml b/config/spotbugs/spotbugs-exclude.xml index 5fdde38..a8e0594 100644 --- a/config/spotbugs/spotbugs-exclude.xml +++ b/config/spotbugs/spotbugs-exclude.xml @@ -19,4 +19,7 @@ + + + \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index a4b76b9..1b33c55 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 66cd5a0..6514f91 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-all.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index f5feea6..23d15a9 100755 --- a/gradlew +++ b/gradlew @@ -86,8 +86,7 @@ done # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s -' "$PWD" ) || exit +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -115,7 +114,7 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar +CLASSPATH="\\\"\\\"" # Determine the Java command to use to start the JVM. @@ -206,7 +205,7 @@ fi DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Collect all arguments for the java command: -# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, # and any embedded shellness will be escaped. # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be # treated as '${Hostname}' itself on the command line. @@ -214,7 +213,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" # Stop when "xargs" is not available. diff --git a/gradlew.bat b/gradlew.bat index 9d21a21..db3a6ac 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -70,11 +70,11 @@ goto fail :execute @rem Setup the command line -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar +set CLASSPATH= @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* :end @rem End local scope for the variables with windows NT shell