apache / apache/maven-wrapper

[MWRAPPER-102] Self upgrading with a custom repository url fails

Open
#320 5 comments 0 reactions 0 assignees View on GitHub
bug priority:major
Dominant language
Java
Stars
254
Forks
78
Avg merge
5h 26m
Merged PRs (30d)
2

Description

**[Niels Basjes](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=nielsbasjes)** opened **[MWRAPPER-102](https://issues.apache.org/jira/browse/MWRAPPER-102?redirect=false)** and commented

Assume a project without the maven wrapper present and the ~/.m2/wrapper/dists is empty.

In the project install the 3.1.1 wrapper version with a different REPO url

```bash
$ MVNW_REPOURL=https://repo1.maven.org/maven2 mvn org.apache.maven.plugins:maven-wrapper-plugin:3.1.1:wrapper
```

The config now contains

```bash
$ fgrep Url .mvn/wrapper/maven-wrapper.properties 
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.9.0/apache-maven-3.9.0-bin.zip
wrapperUrl=https://repo1.maven.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
```

Now try to self upgrade

```bash
$ MVNW_REPOURL=https://repo1.maven.org/maven2 ./mvnw wrapper:wrapper  
Exception in thread "main" java.io.FileNotFoundException: https://repo1.maven.org/org/apache/maven/apache-maven/3.9.0/apache-maven-3.9.0-bin.zip     at
```

Important to note here

1. The URL it is trying to download from is the specified hostname but without the specified path on that host.
2. The `distributionUrl` specified in  `.mvn/wrapper/maven-wrapper.properties` is the valid URL that yields the correct file.

---

**Affects:** 3.1.1, 3.2.0

**Issue Links:**
- [MWRAPPER-68](https://issues.apache.org/jira/browse/MWRAPPER-68) MVNW_REPOURL improperly formed distributionUrl
(_**"duplicates"**_)
- [MWRAPPER-77](https://issues.apache.org/jira/browse/MWRAPPER-77) wrapper:wrapper does not update scripts

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.