Skip to content

Improve Maven POM resolution errors - #12320

Open
jonathanpeppers wants to merge 3 commits into
dotnet:mainfrom
jonathanpeppers:jonathanpeppers-improve-maven-errors
Open

Improve Maven POM resolution errors#12320
jonathanpeppers wants to merge 3 commits into
dotnet:mainfrom
jonathanpeppers:jonathanpeppers-improve-maven-errors

Conversation

@jonathanpeppers

Copy link
Copy Markdown
Member

AndroidMavenLibrary resolution 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 LoggingPomResolver call 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

  • Useful description of why the change is necessary.
  • Links to issues fixed.
  • Unit tests (MavenDownloadTests: 18 passed).

jonathanpeppers and others added 2 commits August 7, 2026 14:47
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>
Copilot AI review requested due to automatic review settings August 7, 2026 19:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 LoggingPomResolver and 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

  • GetRepository uses the raw Repository metadata string for GetKnownRepository, 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 despite MavenRepository normalizing 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 &&

Comment thread src/Xamarin.Android.Build.Tasks/Properties/Resources.resx
Describe the structured unresolved-artifact details passed through the existing localized XA4237 placeholder.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve AndroidMavenLibrary dependency resolution error messaging

2 participants