apache / apache/maven-resolver-ant-tasks
User settings discovery prefers ~/.ant/settings.xml over ~/.m2/settings.xml
- Dominant language
- Java
- Stars
- 15
- Forks
- 18
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 8
Description
## Summary
User settings discovery prefers `~/.ant/settings.xml` over `~/.m2/settings.xml`, so a stray/leftover `.ant/settings.xml` shadows the real Maven settings and silently disables mirrors/proxies/servers.
## Affected code
`src/main/java/org/apache/maven/resolver/internal/ant/AetherUtils.java` lines 46-54 (master @ `df2908e`)
```java
public static File findUserSettings(final Project project) {
final File userHome = new File(project.getProperty("user.home"));
final File file = new File(new File(userHome, ".ant"), Names.SETTINGS_XML);
if (file.isFile()) {
return file;
} else {
return new File(new File(userHome, ".m2"), Names.SETTINGS_XML);
}
}
```
## Problem
If any `~/.ant/settings.xml` exists — even an empty or stale file — it is used as the user settings and the canonical `~/.m2/settings.xml` (which normally holds mirrors, proxies, and server credentials) is never read.
## Expected behavior
Prefer `~/.m2/settings.xml` (the Maven-standard location), or make the `.ant` preference explicit and documented. At minimum this precedence should be revisited and covered by a test.
## Impact
Users who happen to have an `.ant/settings.xml` get silently different resolution behavior (missing mirrors/credentials) than Maven.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in src/main/java/org/apache/maven/resolver/internal/ant/AetherUtils.java at findUserSettings, then locate the existing tests for settings discovery. Reproduce the case where both ~/.ant/settings.xml and ~/.m2/settings.xml exist, and add coverage showing the intended precedence; done means the selected location is explicit and the regression is tested.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100