elharo opened a new issue, #1620:
URL: https://github.com/apache/maven-dependency-plugin/issues/1620
## Problem
The `appendArtifactPath()` method at line 278 calls
`art.getFile().getPath()` without checking if `getFile()` returns null:
```java
protected void appendArtifactPath(Artifact art, StringBuilder sb) {
if (prefix == null) {
String file = art.getFile().getPath(); // NPE if getFile() returns
null
// ...
}
}
```
Artifacts without a resolved file (e.g., system scope or unresolved
dependencies) can have a null file.
## Fix
Add a null check before calling `getPath()`:
```java
File artifactFile = art.getFile();
if (artifactFile == null) {
sb.append("[unknown]");
return;
}
String file = artifactFile.getPath();
```
## File
`src/main/java/org/apache/maven/plugins/dependency/fromDependencies/BuildClasspathMojo.java:276-292`
--
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]