Skip to content

WriteBundleMojo to support file as a target - #313

Merged
cstamas merged 1 commit into
maveniverse:mainfrom
olamy:feature/write-bundle-file-and-autostore
Jun 23, 2026
Merged

cstamas merged 1 commit into
maveniverse:mainfrom
olamy:feature/write-bundle-file-and-autostore

Conversation

@olamy

@olamy olamy commented Jun 21, 2026 •

Copy link
Copy Markdown
Contributor

Signed-off-by: Olivier Lamy olamy@apache.org

Summary by CodeRabbit

  • New Features
    • Bundle export can now target either an explicit ZIP file path or a directory destination.
    • Providing store is now optional; if omitted, the bundle uses the latest staged store name from the configured prefix.
  • Bug Fixes
    • Improved input validation: the goal now requires at least one of file or directory to be set.
    • Clear precedence: when file is provided, it’s used as the output target (otherwise directory is used).

@coderabbitai

coderabbitai Bot commented Jun 21, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8ccfd259-ed11-4432-8af4-ba5531dc8734

📥 Commits

Reviewing files that changed from the base of the PR and between 3e1cb4e and 08c65c7.

📒 Files selected for processing (3)
  • core/src/main/java/eu/maveniverse/maven/njord/shared/impl/store/DefaultArtifactStoreWriter.java
  • core/src/main/java/eu/maveniverse/maven/njord/shared/store/ArtifactStoreWriter.java
  • plugin/src/main/java/eu/maveniverse/maven/njord/plugin3/WriteBundleMojo.java
🚧 Files skipped from review as they are similar to previous changes (3)
  • core/src/main/java/eu/maveniverse/maven/njord/shared/store/ArtifactStoreWriter.java
  • core/src/main/java/eu/maveniverse/maven/njord/shared/impl/store/DefaultArtifactStoreWriter.java
  • plugin/src/main/java/eu/maveniverse/maven/njord/plugin3/WriteBundleMojo.java

📝 Walkthrough

Walkthrough

Adds a writeAsBundle(ArtifactStore, Path, boolean) overload to the ArtifactStoreWriter interface (as a default method) and implements it concretely in DefaultArtifactStoreWriter with directory-vs-exact-file branching. WriteBundleMojo is updated to expose an optional file parameter, make store/directory non-required, and auto-select the latest staged store via prefix when store is unspecified.

Changes

writeAsBundle file/directory output support

Layer / File(s) Summary
ArtifactStoreWriter interface + DefaultArtifactStoreWriter implementation
core/.../store/ArtifactStoreWriter.java, core/.../impl/store/DefaultArtifactStoreWriter.java
ArtifactStoreWriter gains a default writeAsBundle(ArtifactStore, Path, boolean) overload that delegates to the directory variant or throws UnsupportedOperationException; DefaultArtifactStoreWriter implements the concrete branch: when outputMayBeFile is false it creates the output directory and writes <name>.zip inside it; when true it writes directly to the given path after ensuring parent directories exist.
WriteBundleMojo parameter model and store selection
plugin/.../plugin3/WriteBundleMojo.java
Adds optional file parameter (@Parameter), changes store and directory from required to optional, validates that at least one of file/directory is provided, infers the latest staged store name from the configured prefix when store is absent, selects the ArtifactStore, and calls writeAsBundle with the resolved path and outputMayBeFile flag.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐇 Hop hop, a bundle goes ZIP!
To a file or a folder—take your pick.
The prefix sniffs the latest store,
No required params needed more.
One flag to rule the output path,
The rabbit approves this artifact! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and clearly reflects the main change: adding file target support to WriteBundleMojo.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@plugin/src/main/java/eu/maveniverse/maven/njord/plugin3/WriteBundleMojo.java`:
- Around line 56-57: The null check in the condition at line 56 only validates
against null values but does not account for empty or blank string values in the
file and directory parameters. Modify the condition to treat blank values (empty
strings or whitespace-only strings) as unset by using a method like isBlank() or
isEmpty() in addition to the null checks for both the file and directory
variables, ensuring that empty or blank parameter values are rejected just like
null values and preventing unintended writes to the current working directory
via Paths.get("").
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5e11a488-4a2c-4dac-a5d4-cfe4912c6de4

📥 Commits

Reviewing files that changed from the base of the PR and between 3b33b18 and 35f2345.

📒 Files selected for processing (3)
  • core/src/main/java/eu/maveniverse/maven/njord/shared/impl/store/DefaultArtifactStoreWriter.java
  • core/src/main/java/eu/maveniverse/maven/njord/shared/store/ArtifactStoreWriter.java
  • plugin/src/main/java/eu/maveniverse/maven/njord/plugin3/WriteBundleMojo.java

@olamy
olamy force-pushed the feature/write-bundle-file-and-autostore branch from 3e1cb4e to 08c65c7 Compare June 21, 2026 23:54
@cstamas
cstamas merged commit 03f1bd7 into maveniverse:main Jun 23, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants