Handle pomTarget without a parent directory (#169) - #174
Open
elharo wants to merge 2 commits into
Open
Conversation
CreatePom.execute() threw a NullPointerException when pomTarget was a
bare relative filename such as 'pom.xml', because new File('pom.xml')
returns null from getParentFile(). Resolve a bare pomTarget against the
project base dir before creating the parent directory, so the POM is
written to the Ant project base dir.
elharo
marked this pull request as draft
August 6, 2026 11:28
Contributor
Author
|
The CI failure was in the Ant The test class was missing the Added the |
elharo
marked this pull request as ready for review
August 7, 2026 11:09
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #169
Problem
CreatePom.execute()threw aNullPointerExceptionwhenpomTargetwas a bare relative filename such aspom.xml. For such a valuenew File("pom.xml").getParentFile()returnsnull, so the parent-dir check failed.Fix
Resolve a bare
pomTargetagainst the Ant project base dir before creating the parent directory. The POM is now written to${basedir}/pom.xml, matching the expected behavior of writing to the current working directory / project base dir. Targets with a directory component (e.g.out/pom.xml) behave as before.Test
New
CreatePomNoParentDirTestunit test reproduces the crash: it runs the task withpomTarget="pom.xml"and a project base dir, and asserts the POM is written to${basedir}/pom.xml. Before the fix it fails with the NPE above; after the fix it passes.All 55 tests pass (
mvn verify).