Problem
The filterArtifactsByScope() method at line 452 calls artifact.getScope().equals(scope) without checking if getScope() returns null:
private void filterArtifactsByScope(Set<Artifact> artifacts, String scope) {
artifacts.removeIf(artifact -> artifact.getScope().equals(scope));
}
If artifact.getScope() returns null, this throws a NullPointerException.
Fix
Reverse the comparison or use Objects.equals():
artifacts.removeIf(artifact -> Objects.equals(artifact.getScope(), scope));
File
src/main/java/org/apache/maven/plugins/dependency/analyze/AbstractAnalyzeMojo.java:451-453
Problem
The
filterArtifactsByScope()method at line 452 callsartifact.getScope().equals(scope)without checking ifgetScope()returns null:If
artifact.getScope()returnsnull, this throws aNullPointerException.Fix
Reverse the comparison or use
Objects.equals():File
src/main/java/org/apache/maven/plugins/dependency/analyze/AbstractAnalyzeMojo.java:451-453