Skip to content

Fix #12774: skip consumer POM re-attachment on repeated task segments - #12956

Merged
gnodet merged 1 commit into
masterfrom
fix/12774-forward-port
Aug 30, 2026
Merged

Fix #12774: skip consumer POM re-attachment on repeated task segments#12956
gnodet merged 1 commit into
masterfrom
fix/12774-forward-port

Conversation

@gnodet

@gnodet gnodet commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Forward port of #12916 from maven-4.0.x to master.

  • Hoist the alreadyAttached check before temp file creation to avoid unnecessary I/O on repeated invocations
  • When the consumer POM is already attached, skip creating a temp file and registering it for deferred deletion
  • Add test verifying that calling injectTransformedArtifacts twice does not duplicate the consumer POM artifact

🤖 Generated with Claude Code

…#12916)

* Fix #12774: skip consumer POM re-attachment on repeated task segments

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Hoist alreadyAttached check before temp file creation

Avoid unnecessary I/O on repeated invocations by checking whether
the consumer POM is already attached before creating a temp file
and registering it for deferred deletion.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
@gnodet gnodet added this to the 4.1.0 milestone Aug 30, 2026
@gnodet gnodet added the bug Something isn't working label Aug 30, 2026

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean forward-port of #12916 from maven-4.0.x to master. No adaptation issues.

Observations (informational):

  • Source code change to ConsumerPomArtifactTransformer.java is identical to the merged #12916 — hoisted alreadyAttached check correctly placed before temp file creation
  • Test properly adapted to master conventions: JUnit assertions instead of AssertJ, Map.of() instead of Collections.emptyMap()
  • The alreadyAttached check correctly uses a.getType() for org.apache.maven.artifact.Artifact (from project.getAttachedArtifacts()) — distinct from the consumerPomPresent method that uses a.getExtension() for org.eclipse.aether.artifact.Artifact
  • All findings from our 2 prior reviews of #12916 remain addressed

This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.

Claude Code on behalf of Guillaume Nodet

@gnodet
gnodet merged commit 2ac60f5 into master Aug 30, 2026
24 checks passed
@gnodet
gnodet deleted the fix/12774-forward-port branch August 30, 2026 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant