Potential NPE in PropertiesMojo when artifact.getFile() returns null
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 74/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- java
- Domain
- build-system
Research direction
Start in PropertiesMojo.execute() at the two artifact property-setting paths shown in the issue, including the extra resolution branch. Trace how unresolved or optionally unresolved artifacts can have a null file, then verify that such artifacts no longer trigger an NPE while artifacts with files still produce their absolute paths.
Written by the indexing model from the issue text.
Description
PropertiesMojo.execute() at line 114-118:
for (Artifact artifact : artifacts) {
project.getProperties()
.setProperty(
artifact.getDependencyConflictId(),
artifact.getFile().getAbsolutePath()); // NPE if null
}
project.getArtifacts() can include artifacts where getFile() returns null (e.g., unresolved optional dependencies, artifacts with resolution failures that don't fully fail the build). Calling .getAbsolutePath() on null throws NPE and fails the build.
The extra artifact resolution at lines 129-136 has a similar issue:
artifact = resolverUtil.resolveArtifact(artifact, project.getRemoteProjectRepositories());
this.project.getProperties().setProperty(toConflictId(artifact), artifact.getFile().getAbsolutePath());
If resolution succeeds but returns a null file, this also NPEs.
- Dominant language
- Java
- Stars
- 175
- Forks
- 196
- Avg merge
- 11h 40m
- Merged PRs (30d)
- 11
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/maven-dependency-plugin
-
bug
apache/maven-dependency-plugin#1650 · 1 assignee ·
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 48/100
apache/maven-dependency-plugin#1649 · 1 comment ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 72/100
apache/maven-dependency-plugin#1646 · 2 comments ·
-
bug
apache/maven-dependency-plugin#1645 · 3 comments · 1 assignee ·
-
enhancement
Difficulty 3/5 1-2 days Newbie friendliness 52/100
apache/maven-dependency-plugin#1643 · 1 reaction ·
All issues in apache/maven-dependency-plugin
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100