Uploaded image for project: 'XWiki Commons'
  1. XWiki Commons
  2. XCOMMONS-3919

Maven Central is queried before the configured extension repositories when resolving the BOM imports of an extension POM

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 17.10.0
    • Extension
    • None
    • Unknown

    Description

      Problem

      When resolving a Maven extension, AetherExtensionRepository#createModel builds the effective model of its POM with RepositoryMerging.POM_DOMINANT. Once the effective model is built, Maven's DefaultModelBuilder registers its repositories in the ProjectModelResolver, and these always include central (https://repo.maven.apache.org/maven2) inherited from Maven's super POM. With POM_DOMINANT they are placed before the configured extension repositories.

      As a consequence, the BOM imports (dependencies with the import scope) of an extension's POM are first looked up on Maven Central, even when no configured extension repository points to it (by default only maven-xwiki, i.e. nexus.xwiki.org, which proxies Central). Parent POMs are not affected since they are resolved before central is registered. The repositories declared in the XWiki POMs (e.g. xwiki-releases) don't help either since they are inside the snapshot profile, which is not active there.

      Note that the exclusion of central in AbstractModelConverter does not apply here: it runs on the already-built model.

      Since 17.10.0, xwiki-commons imports software.amazon.awssdk:bom (XCOMMONS-3250), so the resolution of any extension using a 17.10+ XWiki parent goes through this path.

      Consequence (seen on xwiki.org, 2026-11-22/23)

      • Maven Central answered 429 Too Many Requests to both xwiki.org nodes, while nexus.xwiki.org served the same files fine.
      • The resolver retries 429 responses (waiting 5s, 10s, then 15s) while holding the named lock of the artifact.
      • All the other resolutions of the same BOM wait up to 900s for that lock and then fail with FailedToAcquireLockException: Could not acquire shared lock for artifacts: software.amazon.awssdk:bom:pom:2.38.4 in 900 SECONDS.
      • Result: the extensions based on a 17.10+ parent could not be downloaded from extensions.xwiki.org (e.g. Release Notes Application 2.4 and later, whereas 2.3 and earlier, based on a 14.10 parent, worked), so they could not be installed or upgraded, and HTTP threads piled up (172 threads waiting on these locks in one thread dump).

      Workaround

      Make the resolver give up immediately on a 429 so that it falls back to the next repository. The default repositories have to be redeclared for the property to be taken into account (see XCOMMONS-3920):

      extension.repositories = maven-xwiki:maven:https://nexus.xwiki.org/nexus/content/groups/public
      extension.repositories = store.xwiki.com:xwiki:https://store.xwiki.com/xwiki/rest/
      extension.repositories = extensions.xwiki.org:xwiki:https://extensions.xwiki.org/xwiki/rest/
      extension.repositories.maven-xwiki.maven.snapshot = false
      extension.repositories.maven-xwiki.aether.connector.http.retryHandler.serviceUnavailable = 503
      

      Possible fixes (to be discussed)

      • Ignore the central repository coming from the super POM in the ModelResolver used by createModel (same logic as AbstractModelConverter), or redirect it to the configured repositories with a mirror selector.
      • Switching to REQUEST_DOMINANT is not an option since other repositories declared in POMs may be needed.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              vmassol Vincent Massol
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated: