diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 0f32df0..488b84c 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -2,43 +2,53 @@ name: Build
on:
push:
- branches: [ master, develop ]
+ branches: [ main ]
pull_request:
- branches: [ master, develop ]
+ branches: [ main ]
jobs:
- build:
-
+ matrix-build:
runs-on: ubuntu-latest
+ strategy:
+ fail-fast: true
+ matrix:
+ java: [11, 17, 21]
+ concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}-java-${{ matrix.java }}
+ cancel-in-progress: true
+ env:
+ DEFAULT_JAVA: 11
steps:
- - uses: actions/checkout@v2
- - name: Fetch all history for all tags and branches
- run: git fetch --prune --unshallow
- - uses: actions/setup-java@v1
+ - uses: actions/checkout@v4
with:
- java-version: 11
- - name: Cache local Maven repository
- uses: actions/cache@v2
+ fetch-depth: 0
+ - uses: actions/setup-java@v4
with:
- path: ~/.m2/repository
- key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
- restore-keys: |
- ${{ runner.os }}-maven-
- - name: Build with Maven
- run: mvn --errors --batch-mode clean org.jacoco:jacoco-maven-plugin:prepare-agent install
- env:
- MAVEN_OPTS: "-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn"
+ cache: maven
+ distribution: temurin
+ java-version: |
+ 11
+ 17
+ 21
+ - name: Build with Java ${{ matrix.java }}
+ run: mvn --errors --batch-mode clean org.jacoco:jacoco-maven-plugin:prepare-agent install -Djava.version=${{ matrix.java }}
- name: Sonar
- if: ${{ env.SONAR_TOKEN != null }}
- run: mvn --errors --batch-mode "-Dsonar.host.url=https://sonarcloud.io" -Dsonar.organization=itsallcode -Dsonar.login=$SONAR_TOKEN sonar:sonar
+ if: ${{ env.DEFAULT_JAVA == matrix.java && env.SONAR_TOKEN != null }}
+ run: mvn --errors --batch-mode -Dsonar.token=$SONAR_TOKEN sonar:sonar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- MAVEN_OPTS: "-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn"
- name: Publish Test Report
uses: scacap/action-surefire-report@v1
if: always()
with:
report_paths: '**/target/surefire-reports/TEST-*.xml'
github_token: ${{ secrets.GITHUB_TOKEN }}
+
+
+ build:
+ needs: matrix-build
+ runs-on: ubuntu-latest
+ steps:
+ - run: echo "Build successful"
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index a385c7c..2ab060c 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -2,11 +2,9 @@ name: "CodeQL"
on:
push:
- branches: [develop, master]
+ branches: [main]
pull_request:
- branches: [develop, master]
- schedule:
- - cron: '0 4 * * 3'
+ branches: [main]
jobs:
analyze:
@@ -18,27 +16,23 @@ jobs:
steps:
- name: Checkout repository
- uses: actions/checkout@v2
+ uses: actions/checkout@v4
- - uses: actions/setup-java@v1
+ - uses: actions/setup-java@v4
with:
- java-version: 11
-
- - name: Cache local Maven repository
- uses: actions/cache@v2
- with:
- path: ~/.m2/repository
- key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
- restore-keys: |
- ${{ runner.os }}-maven-
+ cache: maven
+ distribution: temurin
+ java-version: |
+ 11
+ 17
- name: Initialize CodeQL
- uses: github/codeql-action/init@v1
+ uses: github/codeql-action/init@v3
with:
languages: java
- name: Autobuild
- uses: github/codeql-action/autobuild@v1
+ uses: github/codeql-action/autobuild@v3
- name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@v1
+ uses: github/codeql-action/analyze@v3
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
index b3c482a..fcbcd7a 100644
--- a/.settings/org.eclipse.jdt.core.prefs
+++ b/.settings/org.eclipse.jdt.core.prefs
@@ -22,6 +22,7 @@ org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
+org.eclipse.jdt.core.compiler.processAnnotations=disabled
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=11
org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..1c5a1c6
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,17 @@
+{
+ "editor.formatOnSave": true,
+ "editor.formatOnSaveMode": "modifications",
+ "editor.codeActionsOnSave": {
+ "source.organizeImports": "explicit",
+ "source.generate.finalModifiers": "explicit",
+ "source.fixAll": "explicit"
+ },
+ "java.saveActions.organizeImports": true,
+ "java.sources.organizeImports.starThreshold": 3,
+ "java.sources.organizeImports.staticStarThreshold": 3,
+ "java.configuration.updateBuildConfiguration": "automatic",
+ "sonarlint.connectedMode.project": {
+ "connectionId": "itsallcode",
+ "projectKey": "org.itsallcode:hamcrest-mutliline-text-matcher"
+ }
+}
\ No newline at end of file
diff --git a/README.md b/README.md
index 35e6303..e6cb066 100644
--- a/README.md
+++ b/README.md
@@ -62,72 +62,3 @@ The Hamcrest Multiline Text Matcher requires Java 11 to run.
| [Maven Surefire Plugin](https://maven.apache.org/surefire/maven-surefire-plugin/) | Unit testing | Apache License 2.0 |
| [OSS Index Maven Plugin](https://sonatype.github.io/ossindex-maven/maven-plugin/) | Checking Dependencies Vulnerability | ASL2 |
| [Versions Maven Plugin](https://www.mojohaus.org/versions-maven-plugin/) | Checking if dependencies updates are available | Apache License 2.0 |
-
-## Development
-
-
-### Generate / update license file header
-
-```bash
-mvn license:update-file-header
-```
-
-## Run local sonar analysis
-
-```bash
-mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar \
- -Dsonar.host.url=https://sonarcloud.io \
- -Dsonar.organization=itsallcode \
- -Dsonar.login=[token]
-```
-
-See analysis results at https://sonarcloud.io/dashboard?id=org.itsallcode%3Ahamcrest-mutliline-text-matcher
-
-## Check for updated dependencies / plugins
-
-```bash
-mvn versions:display-dependency-updates
-```
-
-```bash
-mvn versions:display-plugin-updates
-```
-
-### Publishing to JCenter
-
-1. Add the following to your `~/.m2/settings.xml`:
-
- ```xml
-
-
-
- ossrh
- your-jira-id
- your-jira-pwd
-
-
-
-
- ossrh
-
- true
-
-
- gpg
- the_pass_phrase
-
-
-
-
- ```
-
-1. Checkout the `master` branch.
-1. Update version in `pom.xml`, commit and push.
-1. Run command
-
- ```bash
- mvn -DskipSigningArtifacts=false clean deploy
- ```
-
-1. Create a [release](https://github.com/itsallcode/hamcrest-mutliline-text-matcher/releases) of the `master` branch on GitHub.
-1. After some time the release will be available at [Maven Central](https://repo1.maven.org/maven2/org/itsallcode/hamcrest-mutliline-text-matcher/).
diff --git a/doc/developer_guide/developer_guide.md b/doc/developer_guide/developer_guide.md
index 018a906..f4e4fa0 100644
--- a/doc/developer_guide/developer_guide.md
+++ b/doc/developer_guide/developer_guide.md
@@ -1,29 +1,65 @@
# Developer Guide
-## Publishing to JCenter
+## Generate / update license file header
+
+```bash
+mvn license:update-file-header
+```
+
+## Run local sonar analysis
+
+```bash
+mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar \
+ -Dsonar.token=[token]
+```
+
+See analysis results at https://sonarcloud.io/dashboard?id=org.itsallcode%3Ahamcrest-mutliline-text-matcher
+
+## Check for updated dependencies / plugins
+
+```bash
+mvn versions:display-dependency-updates
+```
+
+```bash
+mvn versions:display-plugin-updates
+```
+
+## Publishing to Maven Central
1. Add the following to your `~/.m2/settings.xml`:
```xml
-
-
- bintray-maven-repo
- [bintray-username]
- [bintray-api-key]
-
-
+
+
+
+ ossrh
+ your-jira-id
+ your-jira-pwd
+
+
+
+
+ ossrh
+
+ true
+
+
+ gpg
+ the_pass_phrase
+
+
+
+
```
-1. Checkout the `master` branch.
+1. Checkout the `main` branch.
1. Update version in `pom.xml`, commit and push.
1. Run command
```bash
- mvn deploy
+ mvn -DskipSigningArtifacts=false clean deploy
```
-1. Create a [release](https://github.com/itsallcode/hamcrest-mutliline-text-matcher/releases) on GitHub.
-1. Sign in at [bintray.com](https://bintray.com/login?forwardedFrom=%2Fitsallcode%2Fitsallcode%2Fhamcrest-mutliline-text-matcher)
-1. Go to the [bintray project page](https://bintray.com/itsallcode/itsallcode/hamcrest-mutliline-text-matcher)
-1. There should be a notice saying "You have 16 unpublished item(s) for this package". Click the "Publish" link. Binaries will be available for download at [jcenter](https://jcenter.bintray.com/org/itsallcode/hamcrest-mutliline-text-matcher/)
-1. Publish to Maven Central by clicking the "Sync" button at [the project page](https://bintray.com/itsallcode/itsallcode/hamcrest-mutliline-text-matcher#central). After some time the new version will appear at [Maven Central](https://repo1.maven.org/maven2/org/itsallcode/hamcrest-mutliline-text-matcher/).
+1. Create a [release](https://github.com/itsallcode/hamcrest-mutliline-text-matcher/releases) of the `main` branch on GitHub.
+1. After some time the release will be available at [Maven Central](https://repo1.maven.org/maven2/org/itsallcode/hamcrest-mutliline-text-matcher/).
diff --git a/pom.xml b/pom.xml
index bd1cb98..4dedae0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,12 +10,14 @@
UTF-8
11
true
+ https://sonarcloud.io
+ itsallcode
org.junit.jupiter
junit-jupiter
- 5.7.0
+ 5.10.1
test
@@ -26,10 +28,29 @@
+
+ org.apache.maven.plugins
+ maven-toolchains-plugin
+ 3.1.0
+
+
+
+ toolchain
+
+
+
+
+
+
+ ${java.version}
+
+
+
+
org.apache.maven.plugins
maven-compiler-plugin
- 3.8.1
+ 3.12.1
${java.version}
@@ -38,7 +59,7 @@
org.codehaus.mojo
license-maven-plugin
- 2.0.0
+ 2.4.0
false
true
@@ -73,17 +94,17 @@
org.apache.maven.plugins
maven-jar-plugin
- 3.2.0
+ 3.3.0
org.apache.maven.plugins
maven-surefire-plugin
- 3.0.0-M5
+ 3.2.5
org.apache.maven.plugins
maven-source-plugin
- 3.2.1
+ 3.3.0
attach-sources
@@ -96,7 +117,7 @@
org.apache.maven.plugins
maven-javadoc-plugin
- 3.2.0
+ 3.6.3
attach-javadocs
@@ -110,14 +131,18 @@
true
true
- false
+ true
+ false
+
+ -html5
+
org.jacoco
jacoco-maven-plugin
- 0.8.6
+ 0.8.11
@@ -136,7 +161,7 @@
org.apache.maven.plugins
maven-enforcer-plugin
- 3.0.0-M3
+ 3.4.1
enforce-maven
@@ -146,7 +171,7 @@
- 3.5.4
+ 3.6.3
@@ -156,7 +181,7 @@
org.codehaus.mojo
versions-maven-plugin
- 2.8.1
+ 2.16.2
package
@@ -170,7 +195,7 @@
org.sonatype.ossindex.maven
ossindex-maven-plugin
- 3.1.0
+ 3.2.0
package
@@ -183,7 +208,7 @@
org.apache.maven.plugins
maven-gpg-plugin
- 1.6
+ 3.1.0
sign-artifacts
@@ -200,12 +225,12 @@
org.apache.maven.plugins
maven-deploy-plugin
- 2.8.2
+ 3.1.1
org.sonatype.plugins
nexus-staging-maven-plugin
- 1.6.8
+ 1.6.13
true
ossrh
diff --git a/src/main/java/org/itsallcode/matcher/MultilineTextMatcher.java b/src/main/java/org/itsallcode/matcher/MultilineTextMatcher.java
index 6745ec2..f5e3f40 100644
--- a/src/main/java/org/itsallcode/matcher/MultilineTextMatcher.java
+++ b/src/main/java/org/itsallcode/matcher/MultilineTextMatcher.java
@@ -41,6 +41,11 @@ public class MultilineTextMatcher extends TypeSafeMatcher
private static final String LINE_ENDING = "\\r\\n|\\r|\\n";
private final String originalText;
+ /**
+ * Create a new instance.
+ *
+ * @param originalText the original text
+ */
public MultilineTextMatcher(final String originalText)
{
this.originalText = originalText;