From a6989c1ea6beed27f571f84b0b811532769e8d01 Mon Sep 17 00:00:00 2001 From: Philippe Charles Date: Thu, 20 Oct 2022 18:00:30 +0200 Subject: [PATCH 01/24] Update for next development version --- heylogs-api/pom.xml | 2 +- heylogs-cli/pom.xml | 2 +- heylogs-maven-plugin/pom.xml | 2 +- pom.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/heylogs-api/pom.xml b/heylogs-api/pom.xml index 037bfba..da6f758 100644 --- a/heylogs-api/pom.xml +++ b/heylogs-api/pom.xml @@ -7,7 +7,7 @@ com.github.nbbrd.heylogs heylogs-parent - 0.4.0 + 0.4.1-SNAPSHOT heylogs-api diff --git a/heylogs-cli/pom.xml b/heylogs-cli/pom.xml index 4984c42..c67d19b 100644 --- a/heylogs-cli/pom.xml +++ b/heylogs-cli/pom.xml @@ -7,7 +7,7 @@ com.github.nbbrd.heylogs heylogs-parent - 0.4.0 + 0.4.1-SNAPSHOT heylogs-cli diff --git a/heylogs-maven-plugin/pom.xml b/heylogs-maven-plugin/pom.xml index accf904..116ff5f 100644 --- a/heylogs-maven-plugin/pom.xml +++ b/heylogs-maven-plugin/pom.xml @@ -7,7 +7,7 @@ com.github.nbbrd.heylogs heylogs-parent - 0.4.0 + 0.4.1-SNAPSHOT heylogs-maven-plugin diff --git a/pom.xml b/pom.xml index 9ffb028..226ccd5 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.github.nbbrd.heylogs heylogs-parent - 0.4.0 + 0.4.1-SNAPSHOT pom heylogs From a2225f8e557e3a57be6015ff4c0cdfd6dbf7915e Mon Sep 17 00:00:00 2001 From: Philippe Charles Date: Fri, 21 Oct 2022 10:42:57 +0200 Subject: [PATCH 02/24] Fix duplicated runs of GitHub workflow --- .github/workflows/java8-maven.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/java8-maven.yml b/.github/workflows/java8-maven.yml index cbcdb0c..520f346 100644 --- a/.github/workflows/java8-maven.yml +++ b/.github/workflows/java8-maven.yml @@ -4,6 +4,7 @@ on: [ push, pull_request ] jobs: build-and-test-job: + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name strategy: fail-fast: false matrix: From c201991dcd5d3fd43c24a215c805d08cc7f9a1c0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 25 Oct 2022 04:58:35 +0000 Subject: [PATCH 03/24] Bump semver4j from 2.1.1 to 2.2.0 Bumps [semver4j](https://github.com/semver4j/semver4j) from 2.1.1 to 2.2.0. - [Release notes](https://github.com/semver4j/semver4j/releases) - [Commits](https://github.com/semver4j/semver4j/compare/v2.1.1...v2.2.0) --- updated-dependencies: - dependency-name: org.semver4j:semver4j dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- heylogs-api/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heylogs-api/pom.xml b/heylogs-api/pom.xml index da6f758..bbe5d31 100644 --- a/heylogs-api/pom.xml +++ b/heylogs-api/pom.xml @@ -50,7 +50,7 @@ org.semver4j semver4j - 2.1.1 + 2.2.0 From 139b77def6f059e67aae15996b6336f74cfe919b Mon Sep 17 00:00:00 2001 From: Philippe Charles Date: Wed, 26 Oct 2022 11:14:02 +0200 Subject: [PATCH 04/24] Improve Maven enforcer rules --- pom.xml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 226ccd5..123bfd4 100644 --- a/pom.xml +++ b/pom.xml @@ -342,18 +342,30 @@ + + + + 3.6.0 - + + true + + true - + + false false - + + + + 8 From 000cdafa7eed595010d2ed9b5fc8f8152db49dc5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Nov 2022 05:13:55 +0000 Subject: [PATCH 05/24] Bump pomchecker-enforcer-rules from 1.3.0 to 1.4.0 Bumps pomchecker-enforcer-rules from 1.3.0 to 1.4.0. --- updated-dependencies: - dependency-name: org.kordamp.maven:pomchecker-enforcer-rules dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 123bfd4..962c8e2 100644 --- a/pom.xml +++ b/pom.xml @@ -326,7 +326,7 @@ org.kordamp.maven pomchecker-enforcer-rules - 1.3.0 + 1.4.0 org.codehaus.mojo From 4f48ddd3b3212a6637eb223c596aed2ac67d74a0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Nov 2022 05:14:06 +0000 Subject: [PATCH 06/24] Bump picocli.version from 4.6.3 to 4.7.0 Bumps `picocli.version` from 4.6.3 to 4.7.0. Updates `picocli` from 4.6.3 to 4.7.0 - [Release notes](https://github.com/remkop/picocli/releases) - [Changelog](https://github.com/remkop/picocli/blob/main/RELEASE-NOTES.md) - [Commits](https://github.com/remkop/picocli/compare/v4.6.3...v4.7.0) Updates `picocli-codegen` from 4.6.3 to 4.7.0 - [Release notes](https://github.com/remkop/picocli/releases) - [Changelog](https://github.com/remkop/picocli/blob/main/RELEASE-NOTES.md) - [Commits](https://github.com/remkop/picocli/compare/v4.6.3...v4.7.0) --- updated-dependencies: - dependency-name: info.picocli:picocli dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: info.picocli:picocli-codegen dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 962c8e2..96d23c6 100644 --- a/pom.xml +++ b/pom.xml @@ -154,7 +154,7 @@ 1.18.24 1.5.1 1.3.1 - 4.6.3 + 4.7.0 From 5f20eb52fff86f9de5c32dcff6de52fc5afb24e1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 31 Oct 2022 04:45:01 +0000 Subject: [PATCH 07/24] Bump java-service-bom from 1.5.1 to 1.5.2 Bumps [java-service-bom](https://github.com/nbbrd/java-service-util) from 1.5.1 to 1.5.2. - [Release notes](https://github.com/nbbrd/java-service-util/releases) - [Changelog](https://github.com/nbbrd/java-service-util/blob/develop/CHANGELOG.md) - [Commits](https://github.com/nbbrd/java-service-util/compare/v1.5.1...v1.5.2) --- updated-dependencies: - dependency-name: com.github.nbbrd.java-service-util:java-service-bom dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 96d23c6..45a1458 100644 --- a/pom.xml +++ b/pom.xml @@ -152,7 +152,7 @@ 1.18.24 - 1.5.1 + 1.5.2 1.3.1 4.7.0 From f5510ac52b50165623b182a804b741cf09a6e8fb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 31 Oct 2022 04:44:57 +0000 Subject: [PATCH 08/24] Bump jreleaser-maven-plugin from 1.2.0 to 1.3.0 Bumps [jreleaser-maven-plugin](https://github.com/jreleaser/jreleaser) from 1.2.0 to 1.3.0. - [Release notes](https://github.com/jreleaser/jreleaser/releases) - [Changelog](https://github.com/jreleaser/jreleaser/blob/main/jreleaser.yml) - [Commits](https://github.com/jreleaser/jreleaser/compare/v1.2.0...v1.3.0) --- updated-dependencies: - dependency-name: org.jreleaser:jreleaser-maven-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- heylogs-cli/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heylogs-cli/pom.xml b/heylogs-cli/pom.xml index c67d19b..5b3e088 100644 --- a/heylogs-cli/pom.xml +++ b/heylogs-cli/pom.xml @@ -150,7 +150,7 @@ org.jreleaser jreleaser-maven-plugin - 1.2.0 + 1.3.0 install From f030b47c6bc58535c57a87c3919541078703e066 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 28 Oct 2022 04:40:37 +0000 Subject: [PATCH 09/24] Bump maven-shade-plugin from 3.4.0 to 3.4.1 Bumps [maven-shade-plugin](https://github.com/apache/maven-shade-plugin) from 3.4.0 to 3.4.1. - [Release notes](https://github.com/apache/maven-shade-plugin/releases) - [Commits](https://github.com/apache/maven-shade-plugin/compare/maven-shade-plugin-3.4.0...maven-shade-plugin-3.4.1) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-shade-plugin dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- heylogs-cli/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heylogs-cli/pom.xml b/heylogs-cli/pom.xml index 5b3e088..29badb1 100644 --- a/heylogs-cli/pom.xml +++ b/heylogs-cli/pom.xml @@ -84,7 +84,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.4.0 + 3.4.1 package From 7516366297eb3a6962d0062dd342dccf1e238559 Mon Sep 17 00:00:00 2001 From: Philippe Charles Date: Thu, 3 Nov 2022 10:13:52 +0100 Subject: [PATCH 10/24] Revert "Bump jreleaser-maven-plugin from 1.2.0 to 1.3.0" This reverts commit f5510ac52b50165623b182a804b741cf09a6e8fb. --- heylogs-cli/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heylogs-cli/pom.xml b/heylogs-cli/pom.xml index 29badb1..aeb622e 100644 --- a/heylogs-cli/pom.xml +++ b/heylogs-cli/pom.xml @@ -150,7 +150,7 @@ org.jreleaser jreleaser-maven-plugin - 1.3.0 + 1.2.0 install From 640eb35c7aa8ecbd5c5bd88f257752f31e19e3c7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 8 Nov 2022 04:21:35 +0000 Subject: [PATCH 11/24] Bump jreleaser-maven-plugin from 1.2.0 to 1.3.1 Bumps [jreleaser-maven-plugin](https://github.com/jreleaser/jreleaser) from 1.2.0 to 1.3.1. - [Release notes](https://github.com/jreleaser/jreleaser/releases) - [Changelog](https://github.com/jreleaser/jreleaser/blob/main/jreleaser.yml) - [Commits](https://github.com/jreleaser/jreleaser/compare/v1.2.0...v1.3.1) --- updated-dependencies: - dependency-name: org.jreleaser:jreleaser-maven-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- heylogs-cli/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heylogs-cli/pom.xml b/heylogs-cli/pom.xml index aeb622e..8731003 100644 --- a/heylogs-cli/pom.xml +++ b/heylogs-cli/pom.xml @@ -150,7 +150,7 @@ org.jreleaser jreleaser-maven-plugin - 1.2.0 + 1.3.1 install From 2d1aa9eaa62b74c048d4dc43e294ceec6e8a4a48 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 2 Nov 2022 04:39:21 +0000 Subject: [PATCH 12/24] Bump checker-qual from 3.26.0 to 3.27.0 Bumps [checker-qual](https://github.com/typetools/checker-framework) from 3.26.0 to 3.27.0. - [Release notes](https://github.com/typetools/checker-framework/releases) - [Changelog](https://github.com/typetools/checker-framework/blob/master/docs/CHANGELOG.md) - [Commits](https://github.com/typetools/checker-framework/compare/checker-framework-3.26.0...checker-framework-3.27.0) --- updated-dependencies: - dependency-name: org.checkerframework:checker-qual dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 45a1458..8c4b9b1 100644 --- a/pom.xml +++ b/pom.xml @@ -42,7 +42,7 @@ org.checkerframework checker-qual - 3.26.0 + 3.27.0 From c8bb2e439238533729c67b28d148f24dd7cea04f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 8 Nov 2022 04:21:42 +0000 Subject: [PATCH 13/24] Bump semver4j from 2.2.0 to 3.0.0 Bumps [semver4j](https://github.com/semver4j/semver4j) from 2.2.0 to 3.0.0. - [Release notes](https://github.com/semver4j/semver4j/releases) - [Commits](https://github.com/semver4j/semver4j/compare/v2.2.0...v3.0.0) --- updated-dependencies: - dependency-name: org.semver4j:semver4j dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- heylogs-api/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heylogs-api/pom.xml b/heylogs-api/pom.xml index bbe5d31..4b29349 100644 --- a/heylogs-api/pom.xml +++ b/heylogs-api/pom.xml @@ -50,7 +50,7 @@ org.semver4j semver4j - 2.2.0 + 3.0.0 From c4826431530b256948f23c6a488131b2bdcd0cf0 Mon Sep 17 00:00:00 2001 From: Philippe Charles Date: Thu, 10 Nov 2022 14:25:01 +0100 Subject: [PATCH 14/24] Extract Java-EA build-and-test from main workflow --- .github/workflows/java-ea-maven.yml | 37 +++++++++++++++++++++++++++++ .github/workflows/java8-maven.yml | 6 ----- 2 files changed, 37 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/java-ea-maven.yml diff --git a/.github/workflows/java-ea-maven.yml b/.github/workflows/java-ea-maven.yml new file mode 100644 index 0000000..3d86d3a --- /dev/null +++ b/.github/workflows/java-ea-maven.yml @@ -0,0 +1,37 @@ +name: Java-EA with Maven + +on: + push: + branches: + - develop + workflow_dispatch: + +jobs: + build-and-test-job: + strategy: + fail-fast: false + matrix: + java: [ '-ea' ] + os: [ ubuntu-latest ] + + name: JDK${{ matrix.java }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout source code + uses: actions/checkout@v3 + with: + submodules: true + fetch-depth: 0 + + - name: Setup Java + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: ${{ matrix.java }} + cache: 'maven' + + - name: Build and (headless) test with Maven + uses: GabrielBB/xvfb-action@v1 + with: + run: mvn -U -B -ntp package diff --git a/.github/workflows/java8-maven.yml b/.github/workflows/java8-maven.yml index 520f346..9b53d72 100644 --- a/.github/workflows/java8-maven.yml +++ b/.github/workflows/java8-maven.yml @@ -10,15 +10,9 @@ jobs: matrix: java: [ 8, 17 ] os: [ ubuntu-latest, macOS-latest, windows-latest ] - experimental: [ false ] - include: - - java: '-ea' - os: ubuntu-latest - experimental: true name: JDK${{ matrix.java }} on ${{ matrix.os }} runs-on: ${{ matrix.os }} - continue-on-error: ${{ matrix.experimental }} steps: - name: Checkout source code From 018387dcafe7a190f7abd158ef63d03036e997d8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 14 Nov 2022 04:12:50 +0000 Subject: [PATCH 15/24] Bump modernizer-maven-plugin from 2.4.0 to 2.5.0 Bumps [modernizer-maven-plugin](https://github.com/gaul/modernizer-maven-plugin) from 2.4.0 to 2.5.0. - [Release notes](https://github.com/gaul/modernizer-maven-plugin/releases) - [Commits](https://github.com/gaul/modernizer-maven-plugin/compare/modernizer-maven-plugin-2.4.0...modernizer-maven-plugin-2.5.0) --- updated-dependencies: - dependency-name: org.gaul:modernizer-maven-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 8c4b9b1..b0e71ca 100644 --- a/pom.xml +++ b/pom.xml @@ -394,7 +394,7 @@ org.gaul modernizer-maven-plugin - 2.4.0 + 2.5.0 1.8 From 40ef7c3e5447f7c70a5b922a9027ed0c9e7fbdc5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 18 Nov 2022 04:13:17 +0000 Subject: [PATCH 16/24] Bump maven-install-plugin from 3.0.1 to 3.1.0 Bumps [maven-install-plugin](https://github.com/apache/maven-install-plugin) from 3.0.1 to 3.1.0. - [Release notes](https://github.com/apache/maven-install-plugin/releases) - [Commits](https://github.com/apache/maven-install-plugin/compare/maven-install-plugin-3.0.1...maven-install-plugin-3.1.0) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-install-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b0e71ca..2f3a29a 100644 --- a/pom.xml +++ b/pom.xml @@ -83,7 +83,7 @@ org.apache.maven.plugins maven-install-plugin - 3.0.1 + 3.1.0 org.apache.maven.plugins From 683278707b52a461cc653149b4de1f75034628e8 Mon Sep 17 00:00:00 2001 From: Philippe Charles Date: Tue, 22 Nov 2022 14:04:35 +0100 Subject: [PATCH 17/24] Validate project version with Semantic Versioning specification in Maven plugin --- CHANGELOG.md | 4 ++++ .../java/nbbrd/heylogs/maven/plugin/CheckMojo.java | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 44046ce..fcfdc39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added + +- Validate project version with Semantic Versioning specification in Maven plugin [#45](https://github.com/nbbrd/heylogs/issues/45) + ## [0.4.0] - 2022-10-20 ### Added diff --git a/heylogs-maven-plugin/src/main/java/nbbrd/heylogs/maven/plugin/CheckMojo.java b/heylogs-maven-plugin/src/main/java/nbbrd/heylogs/maven/plugin/CheckMojo.java index 15d2c15..ab85723 100644 --- a/heylogs-maven-plugin/src/main/java/nbbrd/heylogs/maven/plugin/CheckMojo.java +++ b/heylogs-maven-plugin/src/main/java/nbbrd/heylogs/maven/plugin/CheckMojo.java @@ -10,6 +10,7 @@ import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; +import org.semver4j.Semver; import java.io.File; import java.io.IOException; @@ -29,6 +30,9 @@ public final class CheckMojo extends AbstractMojo { @Parameter(defaultValue = "false", property = "heylogs.semver") private boolean semver; + @Parameter(defaultValue = "${project.version}", readonly = true) + private String projectVersion; + @Override public void execute() throws MojoExecutionException { if (skip) { @@ -46,8 +50,14 @@ public void execute() throws MojoExecutionException { Document changelog = read(); if (semver) { - getLog().info("Using semver rule"); - System.setProperty(Rule.ENABLE_KEY, "semver"); + getLog().info("Using Semantic Versioning specification"); + if (Semver.isValid(projectVersion)) { + getLog().info("Valid project version"); + System.setProperty(Rule.ENABLE_KEY, "semver"); + } else { + getLog().error(String.format("Invalid project version: '%s' must follow Semantic Versioning specification (https://semver.org/)", projectVersion)); + throw new MojoExecutionException("Invalid project version. See above for details."); + } } List failures = Failure.allOf(changelog, RuleLoader.load()); From 3282fc15719a080c19b071f66c3b9f7416853dbe Mon Sep 17 00:00:00 2001 From: Philippe Charles Date: Tue, 22 Nov 2022 15:12:30 +0100 Subject: [PATCH 18/24] Modify check goal in Maven plugin to raise error if changelog is missing on root project --- CHANGELOG.md | 4 ++ .../nbbrd/heylogs/maven/plugin/CheckMojo.java | 66 ++++++++++++++----- 2 files changed, 53 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fcfdc39..1c47fe6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - Validate project version with Semantic Versioning specification in Maven plugin [#45](https://github.com/nbbrd/heylogs/issues/45) +### Changed + +- Modify check goal in Maven plugin to raise error if changelog is missing on root project + ## [0.4.0] - 2022-10-20 ### Added diff --git a/heylogs-maven-plugin/src/main/java/nbbrd/heylogs/maven/plugin/CheckMojo.java b/heylogs-maven-plugin/src/main/java/nbbrd/heylogs/maven/plugin/CheckMojo.java index ab85723..6903dc1 100644 --- a/heylogs-maven-plugin/src/main/java/nbbrd/heylogs/maven/plugin/CheckMojo.java +++ b/heylogs-maven-plugin/src/main/java/nbbrd/heylogs/maven/plugin/CheckMojo.java @@ -33,6 +33,9 @@ public final class CheckMojo extends AbstractMojo { @Parameter(defaultValue = "${project.version}", readonly = true) private String projectVersion; + @Parameter(defaultValue = "${project.basedir}", readonly = true) + private File projectBaseDir; + @Override public void execute() throws MojoExecutionException { if (skip) { @@ -40,38 +43,67 @@ public void execute() throws MojoExecutionException { return; } - if (!inputFile.exists()) { - getLog().info("Changelog not found"); - return; + if (semver) { + enableSemanticVersioning(); + } + + if (inputFile.exists()) { + validateFile(); + } else { + if (isRootProject()) { + raiseErrorMissingFile(); + } else { + notifyMissingFile(); + } } + } + + private void enableSemanticVersioning() throws MojoExecutionException { + getLog().info("Using Semantic Versioning specification"); + if (Semver.isValid(projectVersion)) { + getLog().info("Valid project version"); + System.setProperty(Rule.ENABLE_KEY, "semver"); + } else { + getLog().error(String.format("Invalid project version: '%s' must follow Semantic Versioning specification (https://semver.org/)", projectVersion)); + throw new MojoExecutionException("Invalid project version. See above for details."); + } + } + private void validateFile() throws MojoExecutionException { try { getLog().info("Reading " + inputFile); Document changelog = read(); - if (semver) { - getLog().info("Using Semantic Versioning specification"); - if (Semver.isValid(projectVersion)) { - getLog().info("Valid project version"); - System.setProperty(Rule.ENABLE_KEY, "semver"); - } else { - getLog().error(String.format("Invalid project version: '%s' must follow Semantic Versioning specification (https://semver.org/)", projectVersion)); - throw new MojoExecutionException("Invalid project version. See above for details."); - } - } - List failures = Failure.allOf(changelog, RuleLoader.load()); if (!failures.isEmpty()) { - getLog().error("Invalid CHANGELOG"); + getLog().error("Invalid changelog"); failures.forEach(failure -> getLog().error(failure.toString())); - throw new MojoExecutionException("Invalid CHANGELOG"); + throw new MojoExecutionException("Invalid changelog"); } - getLog().info("Valid CHANGELOG"); + getLog().info("Valid changelog"); } catch (IOException ex) { throw new MojoExecutionException("Error while checking changelog", ex); } } + private boolean isRootProject() { + File parentDir = projectBaseDir.getParentFile(); + if (parentDir != null) { + File parentPom = new File(parentDir, "pom.xml"); + return !parentPom.exists(); + } + return true; + } + + private void raiseErrorMissingFile() throws MojoExecutionException { + getLog().error("Missing changelog"); + throw new MojoExecutionException("Missing changelog"); + } + + private void notifyMissingFile() { + getLog().info("Changelog not found"); + } + public Document read() throws IOException { Parser parser = Parser.builder().build(); try (Reader reader = Files.newBufferedReader(inputFile.toPath())) { From 3dd45ef119e4e527cb15612074c1c810b29036e9 Mon Sep 17 00:00:00 2001 From: Philippe Charles Date: Tue, 22 Nov 2022 15:43:24 +0100 Subject: [PATCH 19/24] Change default phase of check goal to VALIDATE in Maven plugin --- CHANGELOG.md | 3 ++- .../src/main/java/nbbrd/heylogs/maven/plugin/CheckMojo.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c47fe6..5f4b9ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,8 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ### Changed -- Modify check goal in Maven plugin to raise error if changelog is missing on root project +- Modify check goal in Maven plugin to raise error if changelog is missing on root project [#46](https://github.com/nbbrd/heylogs/issues/46) +- Change default phase of check goal to `VALIDATE` in Maven plugin [#47](https://github.com/nbbrd/heylogs/issues/47) ## [0.4.0] - 2022-10-20 diff --git a/heylogs-maven-plugin/src/main/java/nbbrd/heylogs/maven/plugin/CheckMojo.java b/heylogs-maven-plugin/src/main/java/nbbrd/heylogs/maven/plugin/CheckMojo.java index 6903dc1..6e9f440 100644 --- a/heylogs-maven-plugin/src/main/java/nbbrd/heylogs/maven/plugin/CheckMojo.java +++ b/heylogs-maven-plugin/src/main/java/nbbrd/heylogs/maven/plugin/CheckMojo.java @@ -18,7 +18,7 @@ import java.nio.file.Files; import java.util.List; -@Mojo(name = "check", defaultPhase = LifecyclePhase.GENERATE_RESOURCES, threadSafe = true) +@Mojo(name = "check", defaultPhase = LifecyclePhase.VALIDATE, threadSafe = true) public final class CheckMojo extends AbstractMojo { @Parameter(defaultValue = "${project.basedir}/CHANGELOG.md", property = "heylogs.input.file") From 20cd0065f98dba7088789d01767fa3ea6cd9c102 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 8 Nov 2022 04:21:55 +0000 Subject: [PATCH 20/24] Bump maven-plugin-annotations from 3.6.4 to 3.7.0 Bumps [maven-plugin-annotations](https://github.com/apache/maven-plugin-tools) from 3.6.4 to 3.7.0. - [Release notes](https://github.com/apache/maven-plugin-tools/releases) - [Commits](https://github.com/apache/maven-plugin-tools/compare/maven-plugin-tools-3.6.4...maven-plugin-tools-3.7.0) --- updated-dependencies: - dependency-name: org.apache.maven.plugin-tools:maven-plugin-annotations dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- heylogs-maven-plugin/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heylogs-maven-plugin/pom.xml b/heylogs-maven-plugin/pom.xml index 116ff5f..b22cf26 100644 --- a/heylogs-maven-plugin/pom.xml +++ b/heylogs-maven-plugin/pom.xml @@ -38,7 +38,7 @@ org.apache.maven.plugin-tools maven-plugin-annotations - 3.6.4 + 3.7.0 provided From e2e01ad1fc9cffe72f3e6d63ffc7631eee218079 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 8 Nov 2022 04:21:49 +0000 Subject: [PATCH 21/24] Bump maven-plugin-plugin from 3.6.4 to 3.7.0 Bumps [maven-plugin-plugin](https://github.com/apache/maven-plugin-tools) from 3.6.4 to 3.7.0. - [Release notes](https://github.com/apache/maven-plugin-tools/releases) - [Commits](https://github.com/apache/maven-plugin-tools/compare/maven-plugin-tools-3.6.4...maven-plugin-tools-3.7.0) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-plugin-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- heylogs-maven-plugin/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heylogs-maven-plugin/pom.xml b/heylogs-maven-plugin/pom.xml index b22cf26..f4ce11c 100644 --- a/heylogs-maven-plugin/pom.xml +++ b/heylogs-maven-plugin/pom.xml @@ -49,7 +49,7 @@ org.apache.maven.plugins maven-plugin-plugin - 3.6.4 + 3.7.0 From 17c7c7c42b8a66cdca37c89ae3998f13369d7173 Mon Sep 17 00:00:00 2001 From: Philippe Charles Date: Wed, 23 Nov 2022 15:44:17 +0100 Subject: [PATCH 22/24] Enable parallel execution of junit5 tests --- pom.xml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pom.xml b/pom.xml index 2f3a29a..46729de 100644 --- a/pom.xml +++ b/pom.xml @@ -107,6 +107,21 @@ + + + org.apache.maven.plugins + maven-surefire-plugin + + + + + junit.jupiter.execution.parallel.enabled=true + junit.jupiter.execution.parallel.mode.default=concurrent + + + + + From 97945818f5b43aa436764feb70295e6cce3b9371 Mon Sep 17 00:00:00 2001 From: Philippe Charles Date: Tue, 29 Nov 2022 09:30:12 +0100 Subject: [PATCH 23/24] Update CHANGELOG.md for next release --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f4b9ed..19665ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +## [0.5.0] - 2022-11-29 + ### Added - Validate project version with Semantic Versioning specification in Maven plugin [#45](https://github.com/nbbrd/heylogs/issues/45) @@ -65,7 +67,8 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - Initial release -[Unreleased]: https://github.com/nbbrd/heylogs/compare/v0.4.0...HEAD +[Unreleased]: https://github.com/nbbrd/heylogs/compare/v0.5.0...HEAD +[0.5.0]: https://github.com/nbbrd/heylogs/compare/v0.4.0...v0.5.0 [0.4.0]: https://github.com/nbbrd/heylogs/compare/v0.3.2...v0.4.0 [0.3.2]: https://github.com/nbbrd/heylogs/compare/v0.3.1...v0.3.2 [0.3.1]: https://github.com/nbbrd/heylogs/compare/v0.3.0...v0.3.1 From d08c08bf2abd612ee57d4163f0181efbacc165ad Mon Sep 17 00:00:00 2001 From: Philippe Charles Date: Tue, 29 Nov 2022 09:43:33 +0100 Subject: [PATCH 24/24] Update versions for release --- heylogs-api/pom.xml | 2 +- heylogs-cli/pom.xml | 2 +- heylogs-maven-plugin/pom.xml | 2 +- pom.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/heylogs-api/pom.xml b/heylogs-api/pom.xml index 4b29349..571e3fd 100644 --- a/heylogs-api/pom.xml +++ b/heylogs-api/pom.xml @@ -7,7 +7,7 @@ com.github.nbbrd.heylogs heylogs-parent - 0.4.1-SNAPSHOT + 0.5.0 heylogs-api diff --git a/heylogs-cli/pom.xml b/heylogs-cli/pom.xml index 8731003..6b56e14 100644 --- a/heylogs-cli/pom.xml +++ b/heylogs-cli/pom.xml @@ -7,7 +7,7 @@ com.github.nbbrd.heylogs heylogs-parent - 0.4.1-SNAPSHOT + 0.5.0 heylogs-cli diff --git a/heylogs-maven-plugin/pom.xml b/heylogs-maven-plugin/pom.xml index f4ce11c..d4059fe 100644 --- a/heylogs-maven-plugin/pom.xml +++ b/heylogs-maven-plugin/pom.xml @@ -7,7 +7,7 @@ com.github.nbbrd.heylogs heylogs-parent - 0.4.1-SNAPSHOT + 0.5.0 heylogs-maven-plugin diff --git a/pom.xml b/pom.xml index 46729de..acd6edb 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.github.nbbrd.heylogs heylogs-parent - 0.4.1-SNAPSHOT + 0.5.0 pom heylogs