You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit c4922bf
Browse filesBrowse the repository at this point in the historyBrowse files
docs: document problem matcher (and how to disable it), Maven Wrapper caching, and generated interactiveMode (#1075)
* docs: document the Java problem matcher and how to disable it
Add an advanced-usage section explaining the javac/java problem matcher that
setup-java registers, and how to turn it off for a job using the built-in
::remove-matcher:: workflow command (owners javac and java).
Co-authored-by: Copilot App <[email protected]>
* docs: document Maven Wrapper caching and generated interactiveMode
- README: note that cache: 'maven' also caches/restores the Maven Wrapper
distribution (~/.m2/wrapper/dists), not just the local repository.
- advanced-usage: note that the generated settings.xml sets interactiveMode=false
for non-interactive CI runs.
Co-authored-by: Copilot App <[email protected]>
* Clarify Java problem matcher annotations
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot <[email protected]>
---------
Co-authored-by: Copilot App <[email protected]>
Copy file name to clipboardExpand all lines: README.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -147,6 +147,8 @@ The workflow output `cache-hit` is set to indicate if an exact match was found f
147
147
148
148
The cache input is optional, and caching is turned off by default.
149
149
150
+
**Maven Wrapper:** when `cache: 'maven'` is enabled, the action also caches and restores the Maven Wrapper distribution downloaded to `~/.m2/wrapper/dists` (in addition to the local repository), so wrapper-based (`./mvnw`) builds don't re-download the wrapper on every run. This is keyed on `**/.mvn/wrapper/maven-wrapper.properties` as shown above.
Copy file name to clipboardExpand all lines: docs/advanced-usage.md
+40Lines changed: 40 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -516,6 +516,8 @@ The two `settings.xml` files created from the above example look like the follow
516
516
517
517
***NOTE***: The `settings.xml` file is created in the Actions `$HOME/.m2` directory. If you have an existing `settings.xml` file at that location, it will be overwritten. See [below](#apache-maven-with-a-settings-path) for using the `settings-path` to change your `settings.xml` file location.
518
518
519
+
***NOTE***: The generated `settings.xml` sets `<interactiveMode>false</interactiveMode>` so that Maven never blocks a CI run waiting on an interactive prompt. This is applied automatically whenever the action generates `settings.xml`.
520
+
519
521
If you don't want to overwrite the `settings.xml` file, you can set `overwrite-settings: false`
520
522
521
523
### Extra setup for pom.xml:
@@ -601,6 +603,44 @@ jobs:
601
603
- This setting only affects Maven. It has no effect on Gradle, sbt, or other build tools.
602
604
- `-ntp`only controls transfer/progress output; it does not change whether Maven runs in batch mode. Use `-B`/`--batch-mode` (or `<interactiveMode>false</interactiveMode>` in `settings.xml`) if you also want non-interactive runs.
603
605
606
+
## Java problem matcher (compiler annotations)
607
+
608
+
`setup-java`registers a [problem matcher](https://github.com/actions/toolkit/blob/main/docs/problem-matchers.md) for Java after installing the JDK. It scans the log output of subsequent steps and turns `javac` diagnostics into GitHub [annotations](https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#setting-a-warning-message) that appear in the run summary and inline on the affected files. It matches two kinds of lines:
609
+
610
+
- Compiler errors and warnings, e.g. `App.java:12: error: cannot find symbol` (owner `javac`).
611
+
- Uncaught-exception header lines, e.g. `Exception in thread "main" ...`; because these lines have no file or line captures, they appear as log/run-level annotations rather than inline file annotations (owner `java`).
612
+
613
+
This is enabled by default and requires no configuration.
614
+
615
+
### Disabling the problem matcher
616
+
617
+
There is no action input to turn the matcher off, but you can disable it for the rest of the job with the built-in [`remove-matcher`](https://github.com/actions/toolkit/blob/main/docs/problem-matchers.md#remove-a-problem-matcher) workflow command. Pass the matcher **owner** (not a file name); the Java matcher defines two owners, `javac` and `java`, so remove both to fully suppress it:
618
+
619
+
```yaml
620
+
jobs:
621
+
build:
622
+
runs-on: ubuntu-latest
623
+
624
+
steps:
625
+
- uses: actions/checkout@v6
626
+
- uses: actions/setup-java@v5
627
+
with:
628
+
distribution: '<distribution>'
629
+
java-version: '21'
630
+
631
+
- name: Disable the Java problem matcher
632
+
run: |
633
+
echo "::remove-matcher owner=javac::"
634
+
echo "::remove-matcher owner=java::"
635
+
636
+
- name: Build with Maven
637
+
run: mvn -B package --file pom.xml
638
+
```
639
+
640
+
***NOTES***:
641
+
- `remove-matcher`only stops annotations from being created; the underlying compiler output is unchanged, so a failing `javac`/build still fails the step.
642
+
- The command is scoped to the job, so add the step right after `setup-java` (and before your build) in every job where you want the matcher disabled.
0 commit comments