Skip to content

API does not force ignoring of transitive repositories / mirros in plugins, e.g. assembly pluginΒ #13732

Open

Description

@bmarwell

Affected version

3.10.0

Bug description

When upgrading to 3.10.0 or 4.0.0-rc-*, resolver 2 changed how dependency resolution works.

Without -Daether.remoteRepositoryFilter.prefixes.resolvePrefixFiles=false, some plugins, like assembly-plugin, will try to load prefixes from remote repos defined in dependencies.

Instead, I expected mirror configuration to be used (or remote repository filtering, as I defined).

Code in question:

for (Repository r : model.getRepositories()) {
result.addRepository(ArtifactDescriptorUtils.toRemoteRepository(r));
}

Reproducer: https://codeberg.org/bmarwell/mvn-reproducer-3.10.0-assembly-repoconf

Artifact in question:

package
└─ org.liquibase:liquibase-core:4.31.0
   └─ javax.xml.bind:jaxb-api:2.3.1            (its parent is jaxb-api-parent:2.3.1)
      └─ parent: net.java:jvnet-parent:5       ← declares jvnet-nexus-releases

Leads to check of jvnet-nexus-releases, when it should not:

[DEBUG] Adding artifact: org.hibernate.orm:hibernate-core:jar:6.6.5.Final with file: /home/$USER/.m2/repository/org/hibernate/orm/hibernate-core/6.6.5.Final/hibernate-core-6.6.5.Final.jar to assembly location: lib/hibernate-core-6.6.5.Final.jar.
[DEBUG] Selecting RepositoryConnector for jvnet-nexus-releases (https://maven.java.net/content/repositories/releases/, default, releases)
[DEBUG] Final pipeline: offline( rrf( basic( jvnet-nexus-releases (https://maven.java.net/content/repositories/releases/, default, releases) ) ) )
[WARNING] Could not transfer metadata /.meta/prefixes.txt from/to jvnet-nexus-releases (https://maven.java.net/content/repositories/releases/): (certificate_expired) PKIX path validation failed: java.security.cert.CertPathValidatorException: validity check failed

Positive example when switching back to 3.9.16 or earlier.

Activity

  1. cstamas commented on Oct 28, 2026

    @cstamas
    Member

    So, this is interesting problem. As I see, we face multiple issues here. For start, the CLI -itr option (as can be seen in related changes #1469) is used by Resolver only, only during collection.

    The problem stems from m-assembly-p, and no Resolver collection is involved at all. Here is the problem:
    https://github.com/apache/maven-assembly-plugin/blob/8ab476175f9343498394b1b871d355e043cefb9f/src/main/java/org/apache/maven/plugins/assembly/archive/task/AddDependencySetsTask.java#L151

    It uses Maven ProjectBuilder to build MavenProject for each dependency (!). Maven's project build treat (the dependency POM) as "current project", and obeys whatever stands in it, even repository definitions. Finally, the dependency is resolved using project repositories, and, as you noted, one dependency does define jvnet-nexus-releases repository. So, the artifact is being resolved with ProjectBuilder found repositories (this is how jvnet-nexus-releases comes into play), and RRF immediately kicks in, as "there is new repository seen", as at that moment, Resolver does not knows, does it or will it be used (will not, all is in Central).

    OTOH1, just today on Slack someone brought up dependency handling in use cases like "as project" and "as dependency" (is declared as dependency). And in this case, we clearly violate this, as we use ProjectBuilder to build MavenProject "as project" of a dependency, only to later resolve it (again, there is no collection happening at all). To me, this looks wrong. In fact, build "as project" the dependency POM to me looks very heavy handed, as if you look why we need MavenProject down the road (only to get some interpolators), all of this looks a bit weird to me.

    OTOH2, this is why MIMA MMR extension exists, to be able to get "effective models" of dependencies (the "as dependency" use case), as explained in README: https://github.com/maveniverse/mima/tree/main/extensions/mmr

    OTOH3, I hope it is visible how intents are overlapping/mixing here: we build dependency POMs "as project", and we want them behave "as dependency", which, MavenProject does not know of. This is a misuse of ProjectBuilder IMO, and a long discussion of "how to get effective model of some artifact".

    OTOH4, so one could start tinkering to make ProjectBuilder "smarter" by making ProjectBuildingRequest (pbr) carry some flag "as dependency", and when it is turned on (-itr given on CLI), then ProjectBuilder should take measures to cut remote repositories, but this is becoming nonsensical, as pbr is already so much overloaded that is crazy. Also, even if MIMA MMR-like solution used, one still needs logic handling -itr as even MMR will hand over you the effective POM that will contain the repository, but some code should strip it off, when -itr is set.

  2. bmarwell commented on Oct 29, 2026

    @bmarwell
    ContributorAuthor

    Question, would it obey global mirror configuration?

  3. bmarwell commented on Oct 29, 2026

    @bmarwell
    ContributorAuthor

    I tried both configurations, and both worked:

    Using a mirror config

    I added jvnet-nexus-releases to the list of mirrors, which worked.

    Next was sonatype-nexus-snapshots, but this one was not visible as INFO message. I had to use -X or any suitable logger configuration.

    For this I added a repotiory configuration in ~/.m2/settings.xml, which also worked.

  4. added this to the 3.10.1 milestone on Nov 7, 2026
  5. cstamas commented on Nov 8, 2026

    @cstamas
    Member

    Do we have anything actionable here? IMHO no, but @bmarwell as reporter should confirm.

  6. bmarwell commented on Nov 8, 2026

    @bmarwell
    ContributorAuthor

    Good question. It is a behavioural change that will cause timeouts on air gapped environments with no clear message what happens and why something happens. I find that actionable.

    Or am I missing something?

  7. cstamas commented on Nov 8, 2026

    @cstamas
    Member

    For sure something needs to be done, but IMHO not in 3.10.1 timeframe. We should keep this issue, maybe update it, as IMO same stands for 3.9.x lineage as well (it also has -itr, is not new in 3.10.x).... oh, but that version does not auto-resolve prefixes... right. Also, you provided a circumvention for this case (stop prefix auto resolution).

    I'd say, we should remove this issue from 3.10.1 milestone.

  8. cstamas commented on Nov 8, 2026

    @cstamas
    Member

    btw, consider https://github.com/airlift/provisio as replacement for m-assembly-p, I really wonder what it does in this case.

    @wendigo Any experience with provisio and 3.10.0?

  9. tklasik commented on Nov 9, 2026

    @tklasik

    Good question. It is a behavioural change that will cause timeouts on air gapped environments with no clear message what happens and why something happens. I find that actionable.

    Or am I missing something?

    Timeouts in an air gapped environment is exactly what's impacting me with I think this exact issue. Though as you guys have mentioned its a bit hard to tell if it is exactly this case. . Simply downgrading to 3.9 has been sufficient for now. CI build times exploded moving to 3.10 and I'm currently blaming these timeouts.

    I am unfamiliar with -Daether.remoteRepositoryFilter.prefixes.resolvePrefixFiles=false. Are there any downsides to using this or should I just stick to 3.9.x

  10. cstamas commented on Nov 10, 2026

    @cstamas
    Member

    No downside of using it, you just get the "3.9 feel", as prefix files will not be auto-resolved for you. You can still provide them manually, if needed (but they, especially for Central, tend to be big).

  11. modified the milestones: 3.10.1, 3.10.2 on Nov 11, 2026
  12. bmarwell commented on Nov 12, 2026

    @bmarwell
    ContributorAuthor

    No downside of using it, you just get the "3.9 feel", as prefix files will not be auto-resolved for you. You can still provide them manually, if needed (but they, especially for Central, tend to be big).

    Any idea what to do for 3.10.2? I am not sure just given out the info about that "resolvePrefix" parameter would be sufficient and feasible. I am not sure what would be a good solution...

  13. cstamas commented on Nov 17, 2026

    @cstamas
    Member

    There is IMHO no "good solution" as long plugins use ProjectBuilder to build effective models of dependencies.
    Again, this is why MIMA MMR exists, plus, the logic to obey -itr still needs to be added (to one getting effective model, so in this case m-assembly-p).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions