Skip to content

feat: suppress Maven transfer progress via MAVEN_ARGS by default (add show-download-progress input)#1053

Open
brunoborges wants to merge 3 commits into
mainfrom
feature/maven-args-no-transfer-progress
Open

feat: suppress Maven transfer progress via MAVEN_ARGS by default (add show-download-progress input)#1053
brunoborges wants to merge 3 commits into
mainfrom
feature/maven-args-no-transfer-progress

Conversation

@brunoborges

Copy link
Copy Markdown
Contributor

Description

By default, Maven logs a line for every artifact it downloads, which adds significant noise to CI logs. This PR makes setup-java set the MAVEN_ARGS environment variable to include -ntp (--no-transfer-progress) so that Maven invocations in the job produce cleaner, smaller logs — without needing to add -ntp to every mvn command.

A new optional input lets users opt back into the progress output.

Behavior

  • Default (show-download-progress: false): the action exports MAVEN_ARGS with -ntp appended.
    • Any existing MAVEN_ARGS value is preserved (the flag is appended, not overwritten).
    • Idempotent: the flag is not added if MAVEN_ARGS already contains -ntp or --no-transfer-progress.
  • Opt-in (show-download-progress: true): MAVEN_ARGS is left untouched, preserving Maven's default progress output and any user-provided value.
  • Applies on all platforms. MAVEN_ARGS is honored by Maven 3.9.0+ and the Maven Wrapper; older Maven versions ignore it (no-op). It has no effect on non-Maven builds (Gradle, sbt, etc.).

Example

- uses: actions/setup-java@v5
  with:
    distribution: 'temurin'
    java-version: '21'
    show-download-progress: true # keep Maven download/transfer progress in the logs

Changes

  • action.yml: add show-download-progress input (default false).
  • src/constants.ts: add the input name and MAVEN_ARGS / flag constants.
  • src/maven-args.ts: new configureMavenArgs() implementing the logic above.
  • src/setup-java.ts: invoke configureMavenArgs() during setup.
  • __tests__/maven-args.test.ts: unit tests (default, opt-in, existing-value preservation, idempotency for both flag spellings).
  • docs/advanced-usage.md: new "Maven transfer progress" section + TOC entry.
  • dist/: rebuild bundled action.

Notes

Check list

  • Mark if documentation changes are required.
  • Mark if tests were added or updated to cover the changes.

Set MAVEN_ARGS to include -ntp (--no-transfer-progress) so Maven invocations
in the job produce cleaner CI logs without download/transfer progress noise.
Add a new optional 'show-download-progress' input (default false); set it to
true to keep the progress output.

The change preserves any existing MAVEN_ARGS value (the flag is appended,
not overwritten) and is idempotent (it won't add the flag twice if -ntp or
--no-transfer-progress is already present). Applies on all platforms; honored
by Maven 3.9.0+ and the Maven Wrapper, and is a no-op for non-Maven builds.

- action.yml: add show-download-progress input
- src/constants.ts: add input + MAVEN_ARGS constants
- src/maven-args.ts: new configureMavenArgs()
- src/setup-java.ts: invoke configureMavenArgs() during setup
- __tests__/maven-args.test.ts: unit tests
- docs/advanced-usage.md: document the behavior and input
- dist: rebuild bundled action

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 23, 2026 02:27
@brunoborges brunoborges requested a review from a team as a code owner June 23, 2026 02:27
@brunoborges brunoborges self-assigned this Jun 23, 2026
@brunoborges brunoborges added feature request New feature or request to improve the current logic maven Maven settings, toolchains, and publishing auth labels Jun 23, 2026
@brunoborges brunoborges requested a review from gdams June 23, 2026 02:29

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

This PR reduces CI log noise for Maven builds by defaulting Maven to “no transfer progress” output via MAVEN_ARGS, while adding an input to opt back into showing download/transfer progress.

Changes:

  • Add show-download-progress input (default false) and wire it into setup.
  • Introduce configureMavenArgs() to append -ntp to MAVEN_ARGS (preserving existing values and avoiding duplicates).
  • Add unit tests and documentation describing the new default and opt-in behavior.
Show a summary per file
File Description
action.yml Adds the show-download-progress input with a default of false.
src/constants.ts Defines the new input name and Maven-related constants (MAVEN_ARGS, -ntp, --no-transfer-progress).
src/maven-args.ts Implements the MAVEN_ARGS configuration/idempotency logic.
src/setup-java.ts Invokes Maven args configuration during setup.
__tests__/maven-args.test.ts Adds unit coverage for defaults, opt-in behavior, preservation, and idempotency.
docs/advanced-usage.md Documents the new default behavior and the opt-in input.
dist/setup/index.js Rebuild output including the new logic/constants.
dist/cleanup/index.js Rebuild output including updated constants exports.

Copilot's findings

Tip

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

  • Files reviewed: 6/8 changed files
  • Comments generated: 1

Comment thread src/maven-args.ts
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature request New feature or request to improve the current logic maven Maven settings, toolchains, and publishing auth

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants