Skip to content

MojoExecution.getPlugin().getDependencies() throws NPE when the plugin realm is cached #13307

Closed as not planned

Description

@slachiewicz

Affected version

4.0.0-rc-7; unchanged on master.

Bug description

MojoExecution.getPlugin().getDependencies() (and getDependenciesMap()) throws a NullPointerException from the second execution of a plugin in a build.

Cause: getDependenciesMap() in DefaultMojoExecution wraps PluginDescriptor.getDependencyNode() in a DefaultNode without a null check. The node is set only in DefaultMavenPluginManager.createPluginRealm. When the realm comes from PluginRealmCache, DefaultMavenPluginManager.setupPluginRealm restores the class realm and the artifacts from the CacheRecord but not the dependency node, because CacheRecord holds only those two. The PluginDescriptor constructor that takes a Maven 4 descriptor also sets it to null (// TODO: v4).

Found by the multiple-phase-test IT of the Maven 4 API port of maven-antrun-plugin (#13302), which binds the same plugin twice. Keeping the dependency node in CacheRecord and restoring it with the realm should fix it.

Activity

  1. added
    bug
    on Sep 30, 2026
  2. added 3 commits that reference this issue on Oct 13, 2026
    acac0c7
    f215871
    b449c72
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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions