elharo opened a new pull request, #177:
URL: https://github.com/apache/maven-resolver-ant-tasks/pull/177
Fixes #168
## Summary
`AetherUtils.getMavenHome()` only read the `maven.home` Ant property, which
is almost never set in a plain Ant build. Global mirrors, proxies, and server
credentials from `settings.xml` were therefore silently ignored.
`findGlobalSettings()` also gave `ANT_HOME/etc/settings.xml` precedence over
the Maven `conf/settings.xml`, which is likely inverted.
## Changes
- `AetherUtils.getMavenHome()` now resolves the Maven home in order:
`maven.home` Ant property, `maven.home` system property, `MAVEN_HOME`
environment variable, `M2_HOME` environment variable.
- `AetherUtils.findGlobalSettings()` now prefers the Maven `conf` directory
over the Ant `etc` directory, and only returns an existing settings file.
- Added a package-private `getMavenHome(Project, Map)` overload so the
environment fallback can be tested deterministically.
- New unit test `AetherUtilsTest` covering:
- precedence of the `maven.home` Ant property over the system property,
- fallback to the `maven.home` system property,
- fallback to `MAVEN_HOME`, then `M2_HOME`,
- Maven `conf` preferred over Ant `etc`,
- fallback to Ant `etc` when no Maven settings file exists,
- `null` when neither location holds a settings file.
## Verification
- New tests fail on master (system property ignored; Ant `etc` wins) and
pass with the fix.
- `mvn verify` passes: all 63 tests succeed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]