slachiewicz opened a new issue, #13307: URL: https://github.com/apache/maven/issues/13307
### 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`](https://github.com/apache/maven/blob/master/impl/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultMojoExecution.java) 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`](https://github.com/apache/maven/blob/master/impl/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java) 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. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
