mojohaus/license-maven-plugin

NPE in DependenciesTool when running aggregateAddThirdParty with excludeTransitiveDependencies set to true

Open

#310 opened on Mar 25, 2019

View on GitHub
 (3 comments) (0 reactions) (0 assignees)Java (127 forks)auto 404
help wanted

Repository metrics

Stars
 (115 stars)
PR merge metrics
 (PR metrics pending)

Description

I'm getting an NPE in DependenciesTool.loadProjectDependencies.

The issue seems to be that loadProjectDependencies assumes that all artifacts have a non-null dependency trail.

The artifacts are loaded in loadProjectArtifacts, where reactor projects are excluded as we can't expect Maven to correctly resolve artifacts for projects that may not have been built yet. The method instead replaces reactor projects with their direct dependencies in order to still get the full dependency tree. It then resolves all dependencies except reactor projects. When the dependency lists are returned, the reactor artifacts are included but not fully populated.

I'm not sure what the best fix is here. Maybe loadProjectArtifacts shouldn't return reactor projects at all? I'm not sure why we would want to return reactor projects from that method.

Caused by: java.lang.NullPointerException
    at org.codehaus.mojo.license.api.DependenciesTool.loadProjectDependencies (DependenciesTool.java:243)
    at org.codehaus.mojo.license.api.DefaultThirdPartyHelper.loadDependencies (DefaultThirdPartyHelper.java:156)

Contributor guide