Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
4.0.0-beta-4
-
None
-
Apache Maven 4.0.0-beta-4 (697c543b4e3bbec1b99e9d4d1ee8e0302e748f09)
Maven home: /home/runner/work/maven-repro/maven-repro/apache-maven-4.0.0-beta-4
Java version: 21.0.4, vendor: Eclipse Adoptium, runtime: /usr/lib/jvm/temurin-21-jdk-amd64
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "6.5.0-1025-azure", arch: "amd64", family: "unix"Apache Maven 4.0.0-beta-4 (697c543b4e3bbec1b99e9d4d1ee8e0302e748f09) Maven home: /home/runner/work/maven-repro/maven-repro/apache-maven-4.0.0-beta-4 Java version: 21.0.4, vendor: Eclipse Adoptium, runtime: /usr/lib/jvm/temurin-21-jdk-amd64 Default locale: en, platform encoding: UTF-8 OS name: "linux", version: "6.5.0-1025-azure", arch: "amd64", family: "unix"
Description
If a ~/.m2/settings.xml with an empty <localRepository/> element exists in Maven 4, it downloads dependencies to the current working directory as opposed to ~/.m2/repository.
Steps to reproduce:
- Create a settings.xml with the exact content from the settings.xml in the quick overview. The important part is the empty <localRepository/>.
- Run mvn verify or similar
- Observe it downloading dependencies to the current repository as opposed to ~/.m2/repository
Full reproducer using GitHub Actions: https://github.com/danthe1st/maven-repro/tree/wrong-local-repo
build log with Maven 4 (actual result): https://github.com/danthe1st/maven-repro/actions/runs/11343337296/job/31545681467
The output of mvn verify -X includes:
[DEBUG] Using local repository at /home/runner/work/maven-repro/maven-repro
Files after mvn verify with Maven 4 (the maven.tar.gz and apache-maven-4.0.0-beta-4 directories aren't created from mvn verify):
Run ls aopalliance apache-maven-4.0.0-beta-4 com commons-codec commons-io javax maven.tar.gz net org pom.xml settings.template.xml src target
build log with Maven 3 (expected result): https://github.com/danthe1st/maven-repro/actions/runs/11343337296/job/31545681854
The output of mvn verify -X includes:
[DEBUG] Using local repository at /home/runner/.m2/repository
Files after mvn verify with Maven 3:
Run ls pom.xml settings.template.xml src target