G
YouTube TikTok Games
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ steps:
- Warm JDK-cached jobs can reuse cached release metadata, avoiding vendor API calls while retaining a stale-metadata fallback for vendor outages and rate limits.
- Maven configuration now supports multiple server credentials and custom dependency-resolution repositories.
- Maven signing keys are imported into an isolated temporary GPG home instead of the runner's default keyring.
- Set `problem-matcher: false` to disable Java compiler and uncaught-exception annotations.
- Java compiler and uncaught-exception annotations are now disabled by default. Set `problem-matcher: true` to enable them.
- GraalVM distributions now set `GRAALVM_HOME` in addition to `JAVA_HOME`.
- Invalid boolean values, unsupported distribution/package/platform combinations, and mismatched Maven toolchain ID counts now fail with targeted errors.
- Renamed environment-variable-name inputs so they are not mistaken for secret values:
Expand Down Expand Up @@ -155,7 +155,7 @@ steps:
| `check-latest` | Check remote metadata for the latest version satisfying the version spec before using the runner tool cache. | `false` |
| `force-download` | Always download Java and replace any matching version in the tool cache. | `false` |
| `set-default` | Add Java to `PATH` and set `JAVA_HOME`. When `false`, only version-specific `JAVA_HOME_<major>_<arch>` variables are set. | `true` |
| `problem-matcher` | Register Java compiler and uncaught exception problem matchers. | `true` |
| `problem-matcher` | Register Java compiler and uncaught exception problem matchers. | `false` |
| `verify-signature` | Verify downloaded Java package signatures when supported. Explicitly setting this to `true` makes verification failures fatal. | Distribution-dependent; see [Download integrity and signatures](#download-integrity-and-signatures) |
| `verify-signature-public-key` | One or more ASCII-armored GPG public keys used for signature verification. Concatenate multiple armored key blocks. Custom keys replace the bundled distribution keys. | |
| `token` | Token for fetching GitHub.com-hosted version manifests, useful on GitHub Enterprise Server when unauthenticated requests are rate-limited. | `${{ github.token }}` on GitHub.com; empty string on GHES |
Expand Down
11 changes: 10 additions & 1 deletion __tests__/problem-matcher.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,16 @@ describe('configureProblemMatcher', () => {
jest.resetAllMocks();
});

it('registers the Java problem matcher by default', () => {
it('does not register the Java problem matcher by default', () => {
configureProblemMatcher('/matchers/java.json');

expect(mockInfo).not.toHaveBeenCalled();
expect(mockDebug).toHaveBeenCalledWith('Java problem matcher is disabled');
});

it('registers the Java problem matcher when explicitly enabled', () => {
inputs[INPUT_PROBLEM_MATCHER] = 'true';

configureProblemMatcher('/matchers/java.json');

expect(mockInfo).toHaveBeenCalledWith('##[add-matcher]/matchers/java.json');
Expand Down
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ inputs:
required: false
default: false
problem-matcher:
description: 'Whether to register the Java problem matcher (compiler errors/warnings and uncaught exceptions). Set to "false" to disable annotations.'
description: 'Whether to register the Java problem matcher (compiler errors/warnings and uncaught exceptions). Disabled by default; set to "true" to enable annotations.'
required: false
default: true
default: false
outputs:
distribution:
description: 'Distribution of Java that has been installed'
Expand Down
2 changes: 1 addition & 1 deletion dist/setup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36747,7 +36747,7 @@ async function getJavaDistribution(distributionName, installerOptions, jdkFile)


function configureProblemMatcher(matcherPath) {
const problemMatcherEnabled = (0,util/* getBooleanInput */.Vt)(constants/* INPUT_PROBLEM_MATCHER */.Wt, true);
const problemMatcherEnabled = (0,util/* getBooleanInput */.Vt)(constants/* INPUT_PROBLEM_MATCHER */.Wt, false);
if (!problemMatcherEnabled) {
setup_java_core/* debug */.Yz('Java problem matcher is disabled');
return;
Expand Down
10 changes: 5 additions & 5 deletions docs/advanced-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -1310,17 +1310,17 @@ jobs:

## Java problem matcher (compiler annotations)

By default, `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 Java 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 three kinds of lines:
Java [problem matcher](https://github.com/actions/toolkit/blob/main/docs/problem-matchers.md) registration is disabled by default. Set `problem-matcher: true` to have `setup-java` register the matcher after installing the JDK. When enabled, it scans the log output of subsequent steps and turns Java 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 three kinds of lines:

- Compiler errors and warnings, e.g. `App.java:12: error: cannot find symbol` (owner `javac`).
- Maven compiler errors and warnings, e.g. `[ERROR] /path/App.java:[12,5] cannot find symbol` (owner `maven-javac`).
- 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`).

GitHub Actions limits problem matcher annotations to 10 of each severity per step and 50 annotations per job. Additional diagnostics remain available in the build log. Log grouping does not change these limits because every matched diagnostic still counts as an annotation.

### Disabling the problem matcher
### Enabling the problem matcher

Set `problem-matcher` to `false` to prevent the matcher from being registered:
Set `problem-matcher` to `true` to enable annotations, including in workflows that previously relied on default registration:

```yaml
jobs:
Expand All @@ -1333,13 +1333,13 @@ jobs:
with:
distribution: '<distribution>'
java-version: '21'
problem-matcher: false
problem-matcher: true

- name: Build with Maven
run: mvn package --file pom.xml
```

Disabling the matcher only stops annotations from being created. Compiler output remains in the log, and compilation errors still fail the build step.
Omit `problem-matcher` or set it to `false` to prevent this action invocation from registering the matcher. Compiler output remains in the log, and compilation errors still fail the build step. This does not unregister matchers already registered by other steps or earlier action invocations.

## Publishing using Gradle
```yaml
Expand Down
2 changes: 1 addition & 1 deletion src/problem-matcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {INPUT_PROBLEM_MATCHER} from './constants.js';
import {getBooleanInput} from './util.js';

export function configureProblemMatcher(matcherPath: string): void {
const problemMatcherEnabled = getBooleanInput(INPUT_PROBLEM_MATCHER, true);
const problemMatcherEnabled = getBooleanInput(INPUT_PROBLEM_MATCHER, false);

if (!problemMatcherEnabled) {
core.debug('Java problem matcher is disabled');
Expand Down
Loading