You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "elharo (via GitHub)" <gi...@apache.org> on 2026/07/07 11:16:52 UTC
[I] Potential NPE in PropertiesMojo when artifact.getFile() returns null [maven-dependency-plugin]
elharo opened a new issue, #1647:
URL: https://github.com/apache/maven-dependency-plugin/issues/1647
`PropertiesMojo.execute()` at line 114-118:
```java
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:
```java
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.
--
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: issues-unsubscribe@maven.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Potential NPE in PropertiesMojo when artifact.getFile() returns null [maven-dependency-plugin]
Posted by "slachiewicz (via GitHub)" <gi...@apache.org>.
slachiewicz closed issue #1647: Potential NPE in PropertiesMojo when artifact.getFile() returns null
URL: https://github.com/apache/maven-dependency-plugin/issues/1647
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org