From bf11b74e518efe1d1a3cc3d4152dddd69b17700d Mon Sep 17 00:00:00 2001 From: kaklakariada Date: Sat, 27 Jan 2024 15:30:29 +0100 Subject: [PATCH] Upgrade nexus plugin --- README.md | 33 +++++++++++++++++++++++++-------- build.gradle | 14 ++++++++++---- 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index a3f1876..27feba7 100644 --- a/README.md +++ b/README.md @@ -153,8 +153,9 @@ Also see [`DemoModelMatcher`](src/test/java/com/github/hamstercommunity/matcher/ ## Development ```bash -$ git clone https://github.com/itsallcode/hamcrest-auto-matcher.git -$ ./gradlew check +git clone https://github.com/itsallcode/hamcrest-auto-matcher.git +cd hamcrest-auto-matcher +./gradlew check # Test report: build/reports/tests/index.html ``` @@ -174,6 +175,16 @@ Import into eclipse using [buildship](https://projects.eclipse.org/projects/tool ./gradlew dependencyUpdates ``` + +### Test Coverage + +To calculate and view test coverage: + +```sh +./gradlew check jacocoTestReport +open build/reports/jacoco/test/html/index.html +``` + ### Publish to Maven Central 1. Add the following to your `~/.gradle/gradle.properties`: @@ -187,12 +198,18 @@ Import into eclipse using [buildship](https://projects.eclipse.org/projects/tool signing.secretKeyRingFile= ``` -2. Increment version number in `build.gradle`, update version in README.md, commit and push. -3. Run the following command: +2. Increment version number in `build.gradle` and `README.md`, commit and push. +3. Optional: run the following command to do a dry-run: + + ```sh + ./gradlew clean check build publishToSonatype closeSonatypeStagingRepository --info + ``` + +4. Run the following command to publish to Maven Central: - ```bash - $ ./gradlew clean check build publish closeAndReleaseRepository --info + ```sh + ./gradlew clean check build publishToSonatype closeAndReleaseSonatypeStagingRepository --info ``` -4. Create a new [release](https://github.com/itsallcode/hamcrest-auto-matcher/releases) on GitHub. -5. After some time the release will be available at [Maven Central](https://repo1.maven.org/maven2/org/itsallcode/hamcrest-auto-matcher/). +5. Create a new [release](https://github.com/itsallcode/hamcrest-auto-matcher/releases) on GitHub. +6. After some time the release will be available at [Maven Central](https://repo1.maven.org/maven2/org/itsallcode/hamcrest-auto-matcher/). diff --git a/build.gradle b/build.gradle index 8742ee5..d226d59 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ plugins { id "maven-publish" id "jacoco" id "org.sonarqube" version "4.4.1.3373" - id "io.codearte.nexus-staging" version "0.30.0" + id "io.github.gradle-nexus.publish-plugin" version "1.3.0" id "com.github.ben-manes.versions" version "0.51.0" } @@ -124,10 +124,16 @@ signing { sign publishing.publications.mavenJava } -nexusStaging { + +nexusPublishing { packageGroup = project.group - username = getOptionalProperty("ossrhUsername") - password = getOptionalProperty("ossrhPassword") + repositories { + sonatype { + stagingProfileId = "546ea6ce74787e" + username = getOptionalProperty("ossrhUsername") + password = getOptionalProperty("ossrhPassword") + } + } } def isNonStable = { String version ->