Resolves #913
What changed
This PR fixes Maven reachability metadata fallback handling so fallback URLs are used for downloading metadata without mutating the configured metadata repository object.
Before this change, the fallback path could rewrite the metadata repository configuration by setting the fallback URL directly onto the repository configuration object.
After this change, fallback downloads use the fallback URL as an execution detail while leaving the configured repository object unchanged.
Why
Repository fallback behavior should not silently rewrite the user's configured metadata repository state. Keeping the fallback path non-mutating makes repository selection easier to reason about and safer for later logic that reads that configuration.
Example
Before:
If Maven artifact resolution could not resolve the default metadata artifact, the fallback path could mutate the metadata repository configuration by replacing its URL with the fallback target.
After:
The same fallback download path uses the fallback URL only for the download attempt and leaves the original repository configuration untouched.
Implementation summary
- Remove the fallback
setUrl(targetUrl) mutations in AbstractNativeMojo.
- Remove the stale TODO comments tied to the older fallback behavior.
- Add focused Spock coverage for the default metadata repository fallback path when Maven artifact resolution cannot resolve the default metadata artifact.
Validation
git diff --check
grund check
grund fmt . --marker --check
JAVA_HOME=/home/jovan/.sdkman/candidates/java/17.0.12-graal PATH=/home/jovan/.sdkman/candidates/java/17.0.12-graal/bin:$PATH ./gradlew :native-maven-plugin:test --tests org.graalvm.buildtools.maven.AbstractNativeMojoTest
JAVA_HOME=/home/jovan/.sdkman/candidates/java/17.0.12-graal GRAALVM_HOME=/home/jovan/.sdkman/candidates/java/21.0.11-graal PATH=/home/jovan/.sdkman/candidates/java/17.0.12-graal/bin:$PATH ./gradlew :native-maven-plugin:functionalTest --tests "org.graalvm.buildtools.maven.*Metadata*"
JAVA_HOME=/home/jovan/.sdkman/candidates/java/17.0.12-graal PATH=/home/jovan/.sdkman/candidates/java/17.0.12-graal/bin:$PATH ./gradlew :native-maven-plugin:inspections