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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]