Skip to content

Add Maven compiler problem matcher for javac diagnostics#1086

Merged
brunoborges merged 1 commit into
actions:mainfrom
brunoborges:brunoborges-fix-javac-problem-matcher-maven
Jul 8, 2026
Merged

Add Maven compiler problem matcher for javac diagnostics#1086
brunoborges merged 1 commit into
actions:mainfrom
brunoborges:brunoborges-fix-javac-problem-matcher-maven

Conversation

@brunoborges

Copy link
Copy Markdown
Contributor

Description:

The javac problem matcher registered by setup-java only recognizes javac's native diagnostic format (File.java:12: warning: msg). That works for plain javac and for Gradle (which passes diagnostics through unchanged), but not for Maven. The maven-compiler-plugin reformats every diagnostic to [WARNING] /path/File.java:[12,5] msg, so the existing regex never matches and Maven builds produce zero GitHub annotations even though the warnings/errors appear in the log.

This adds a new maven-javac problem matcher owner to .github/java.json that recognizes the Maven format and captures severity, file, line, column, and message. A separate owner is used because multiple patterns under one owner are treated as a multiline sequence, not as alternatives. Both owners are registered by the same existing ##[add-matcher] call, so no source change is needed. Maven builds now annotate consistently with Gradle and plain javac.

Notes:

  • The existing java and javac owners are unchanged, so current behavior is preserved.
  • java.json is loaded at runtime by the runner and is not part of the webpack bundle, so dist/ does not need regeneration.
  • GitHub matches the severity value case-insensitively, so capturing the uppercase WARNING/ERROR labels works.

Related issue:

Fixes: #1085

Check list:

  • Ran npm run check locally (format, lint, build, test) and all checks pass.
  • Mark if documentation changes are required.
  • Mark if tests were added or updated to cover the changes.

The javac problem matcher only recognized javac's native diagnostic
format (File.java:12: warning: msg), which works for plain javac and
Gradle but not Maven. The maven-compiler-plugin reformats diagnostics
to [WARNING] /path/File.java:[12,5] msg, so Maven builds produced zero
annotations.

Add a new maven-javac matcher owner that recognizes the Maven format,
capturing severity, file, line, column, and message. Maven builds now
annotate consistently with Gradle and plain javac.

Fixes: actions#1085

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@brunoborges brunoborges requested a review from a team as a code owner July 8, 2026 18:14
Copilot AI review requested due to automatic review settings July 8, 2026 18:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Maven-specific javac diagnostic matching to actions/setup-java’s existing Java problem matcher so Maven compiler warnings/errors produce GitHub annotations (consistent with plain javac and Gradle).

Changes:

  • Adds a new problem matcher owner (maven-javac) that matches maven-compiler-plugin’s [WARNING]/[ERROR] /path/File.java:[line,col] message format.
  • Keeps existing java and javac matcher owners unchanged to preserve current behavior.
Show a summary per file
File Description
.github/java.json Adds a maven-javac matcher pattern to recognize Maven compiler plugin diagnostics and enable annotations.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Low

@brunoborges brunoborges merged commit fe9b749 into actions:main Jul 8, 2026
753 of 754 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

javac problem matcher does not annotate Maven compiler output (works for Gradle & plain javac)

2 participants