Summary
AntRunMojo.copyProperties(MavenProject, Project) dereferences artifact.getFile() without a null check when registering the per-dependency artifact properties. Any project dependency whose artifact has no resolved file crashes the mojo with an opaque NullPointerException instead of a clear resolution error.
Affected code
src/main/java/org/apache/maven/plugins/antrun/AntRunMojo.java lines 430-436 (master @ 441382c)
Set<Artifact> depArtifacts = mavenProject.getArtifacts();
for (Artifact artifact : depArtifacts) {
String propName = artifact.getDependencyConflictId();
antProject.setProperty(propertyPrefix + propName, artifact.getFile().getPath());
}
Problem
artifact.getFile() may be null (e.g. partial/offline resolution, or dependencies whose artifact file was never downloaded), and the code calls .getPath() on it directly. The same class already handles this case consistently in getPathFromArtifacts (AntRunMojo.java:362-381), which throws a DependencyResolutionRequiredException when artifact.getFile() == null:
for (Artifact a : artifacts) {
File file = a.getFile();
if (file == null) {
throw new DependencyResolutionRequiredException(a);
}
list.add(file.getPath());
}
Expected behavior
Dependency artifacts with no resolved file should be skipped or reported with a clear, actionable error (matching getPathFromArtifacts), rather than aborting the whole mojo with an NPE that gives no hint of which dependency is the cause.
Summary
AntRunMojo.copyProperties(MavenProject, Project)dereferencesartifact.getFile()without a null check when registering the per-dependency artifact properties. Any project dependency whose artifact has no resolved file crashes the mojo with an opaqueNullPointerExceptioninstead of a clear resolution error.Affected code
src/main/java/org/apache/maven/plugins/antrun/AntRunMojo.javalines 430-436 (master @441382c)Problem
artifact.getFile()may benull(e.g. partial/offline resolution, or dependencies whose artifact file was never downloaded), and the code calls.getPath()on it directly. The same class already handles this case consistently ingetPathFromArtifacts(AntRunMojo.java:362-381), which throws aDependencyResolutionRequiredExceptionwhenartifact.getFile() == null:Expected behavior
Dependency artifacts with no resolved file should be skipped or reported with a clear, actionable error (matching
getPathFromArtifacts), rather than aborting the whole mojo with an NPE that gives no hint of which dependency is the cause.