Skip to content

only-script for Linux clobbers MVNW_REPOURL #368

Open

Description

@commonquail

Affected version

3.3.3

Bug description

Running the Maven Wrapper plugin through the Maven Wrapper's only-script distribution type causes MVNW_REPOURL to be discarded, leaving the distributionUrl written to maven-wrapper.properties at its default value. Consequently, only-script for Linux is unable to update itself in any environment that needs MVNW_REPOURL.

That is, the hypothetical execution

$ MVNW_REPOURL=asdfasdf ./mvnw org.apache.maven.plugins:maven-wrapper-plugin:3.3.3:wrapper -Dtype=only-script -Dmaven=3.9.11 -X

where asdfasdf is a functional mirror should have produced an output similar to

...
[DEBUG] Using repo URL from MVNW_REPOURL environment variable.
[DEBUG] Determined repo URL to use as asdfasdf
[INFO] Configuring .mvn/wrapper/maven-wrapper.properties to use Maven 3.9.11 and download from asdfasdf

but will end up producing

...
[DEBUG] Determined repo URL to use as https://repo.maven.apache.org/maven2
[INFO] Configuring .mvn/wrapper/maven-wrapper.properties to use Maven 3.9.11 and download from https://repo.maven.apache.org/maven2

and the result is consistent with the log messages.

This happens because only-mvnw explicitly unsets MVNW_REPOURL:

https://github.com/apache/maven-wrapper/blob/maven-wrapper-3.3.3/maven-wrapper-distribution/src/resources/only-mvnw#L149

so by the time WrapperMojo tries to read the variable it sees null:

https://github.com/apache/maven-wrapper/blob/maven-wrapper-3.3.3/maven-wrapper-distribution/src/resources/only-mvnw#L149

As far as I can see, this bug does not exist in only-mvnw.cmd.

The issue is exacerbated by the user property distributionUrl value representing the "final" URl. That is, it is not simply a domain substitution and therefore cannot take the place of MVNW_REPOURL.

Activity

  1. added
    bug
    on Sep 5, 2025
  2. self-assigned this
    on Jun 8, 2026
  3. hiSandog commented on Jul 14, 2026

    @hiSandog

    A table-driven regression test around only-script could cover the default, explicit, and invalid configuration cases for “only-script for Linux clobbers MVNW_REPOURL”. That would make the compatibility boundary and the expected fallback behavior precise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions