Improve Maven POM resolution errors - #12320
Open
jonathanpeppers wants to merge 3 commits into
Open
Conversation
Report the unresolved parent or imported POM artifact and the exact repository URL while retaining XA4237 and its localized resource contract. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Move the new XA4237 resolution context into the resource catalog while preserving the existing translated XA4237 format contract. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves diagnostics for <AndroidMavenLibrary> POM resolution by reporting the actual artifact that failed during transitive/parent/imported POM resolution, and by including the exact POM URL in XA4237 to make repository mismatches actionable.
Changes:
- Track the failing artifact inside
LoggingPomResolverand emit XA4237 with a new localized “details” payload including unresolved artifact + POM URL. - Add deterministic unit coverage for imported-BOM failure reporting, and update existing XA4237 message assertions.
- Update XA4237 documentation to reflect the expanded error detail.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/MavenDownloadTests.cs | Updates XA4237 expectations and adds deterministic test coverage for transitive imported-POM failures (including URL capture). |
| src/Xamarin.Android.Build.Tasks/Tasks/MavenDownload.cs | Adds unresolved artifact/URL tracking in the POM resolver and enriches XA4237 with localized resolution details. |
| src/Xamarin.Android.Build.Tasks/Properties/Resources.resx | Adds a new localizable XA4237 details resource used to format resolution failures. |
| src/Xamarin.Android.Build.Tasks/Properties/Resources.Designer.cs | Updates the generated resource accessor for the new XA4237 details string. |
| Documentation/docs-mobile/messages/xa4237.md | Updates XA4237 documentation example and guidance to match the new diagnostics. |
| Documentation/docs-mobile/messages/index.md | Updates the XA4237 index entry to reflect the expanded message shape. |
Files not reviewed (1)
- src/Xamarin.Android.Build.Tasks/Properties/Resources.Designer.cs: Generated file
Suppressed comments (1)
src/Xamarin.Android.Build.Tasks/Tasks/MavenDownload.cs:167
GetRepositoryuses the rawRepositorymetadata string forGetKnownRepository,Uri.TryCreate, and cache hashing without trimming whitespace, so values like " https://repo.example.com/maven2/" (or ones with trailing spaces) will fail URL detection and produce XA4239 even though the URL is otherwise valid. It also hashes the unnormalized URL, so a trailing slash creates a separate cache directory despiteMavenRepositorynormalizing it.
var type = item.GetMetadataOrDefault ("Repository", "Central");
repositoryUrl = type.TrimEnd ('/');
var repo = GetKnownRepository (type);
if (repo == MavenRepository.Central)
repositoryUrl = "https://repo1.maven.org/maven2";
else if (repo == MavenRepository.Google)
repositoryUrl = "https://dl.google.com/android/maven2";
if (repo is null && Uri.TryCreate (type, UriKind.Absolute, out var uri) &&
(uri.Scheme == Uri.UriSchemeHttp || uri.Scheme == Uri.UriSchemeHttps)) {
if (uri.Scheme == Uri.UriSchemeHttp &&
Describe the structured unresolved-artifact details passed through the existing localized XA4237 placeholder. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AndroidMavenLibraryresolution failures currently report the originally requested artifact even when a transitive parent or imported POM is missing. This makes repository mismatches difficult to diagnose.Track the artifact at the failing
LoggingPomResolvercall and include its exact POM URL in XA4237. The existing localized XA4237 format remains compatible, while the new resolution detail uses a separate localizable resource. Documentation and deterministic imported-BOM coverage are included.Fixes #9706
MavenDownloadTests: 18 passed).