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/08/03 18:20:41 UTC
[I] CreatePom throws NullPointerException when pomTarget has no parent directory [maven-resolver-ant-tasks]
elharo opened a new issue, #169:
URL: https://github.com/apache/maven-resolver-ant-tasks/issues/169
## Summary
`CreatePom` throws a `NullPointerException` when `pomTarget` points at a file with no parent directory (e.g. `pomTarget="pom.xml"`).
## Affected code
`src/main/java/org/apache/maven/resolver/internal/ant/tasks/CreatePom.java` lines 332-335 (master @ `df2908e`)
```java
@Override
public void execute() {
if (!pomFile.getParentFile().exists()) {
pomFile.getParentFile().mkdirs();
}
```
## Problem
When `pomTarget` is a bare relative filename such as `pom.xml`, `new File("pom.xml").getParentFile()` returns `null`, so `pomFile.getParentFile().exists()` throws an NPE. Only `pomTarget` values containing a directory component (e.g. `out/pom.xml`) work.
## Expected behavior
A bare filename should be written to the current working directory (skip the parent-dir creation, or treat a null parent as the base dir).
## Reproduction
```xml
<createPom groupId="g" artifactId="a" version="1.0" pomTarget="pom.xml"/>
```
--
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] CreatePom throws NullPointerException when pomTarget has no parent directory [maven-resolver-ant-tasks]
Posted by "elharo (via GitHub)" <gi...@apache.org>.
elharo closed issue #169: CreatePom throws NullPointerException when pomTarget has no parent directory
URL: https://github.com/apache/maven-resolver-ant-tasks/issues/169
--
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