apache / apache/maven-artifact-plugin

Consumer POM temp files: error path leaves pointer to nonexistent file, no cleanup

Open
#245 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
14
Forks
23
Avg merge
1h 27m
Merged PRs (30d)
8

Description

Two issues with the temporary consumer-POM handling in `BuildInfoWriter.printArtifacts()` (lines 180-189) and `DescribeBuildOutputMojo.describeBuildOutput()` (lines 154-165):

1. On copy failure `BuildInfoWriter` only prints `"Error processing consumer POM: " + e` to the buildinfo and continues (line 185), but `pomArtifact` has already been re-pointed at the temp file (line 183). The subsequent `printFile(...)` then fails with the generic "Error processing file ..." from a nonexistent path, masking the real cause.

2. `Files.createTempFile(...)` files are never cleaned up, so every run with Maven 4 transient consumer POMs leaves orphan `consumer-*.pom` files in the project build directory.

Suggested fix: throw `MojoExecutionException` (or record a real error) on copy failure instead of printing and continuing, and delete the temp file when done (`try/finally` or `Files.deleteIfExists`).

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in BuildInfoWriter.printArtifacts() at lines 180-189 and DescribeBuildOutputMojo.describeBuildOutput() at lines 154-165, tracing the temporary consumer-POM copy and print paths. Verify the copy failure preserves its real error and that every Files.createTempFile() result is deleted after processing; done means no misleading nonexistent-file error and no orphan consumer-*.pom files remain.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.