Skip to content

feat: ability to skip jar output#919

Closed
zapkub wants to merge 1 commit intokeycloakify:mainfrom
zapkub:skip-jar-flag
Closed

feat: ability to skip jar output#919
zapkub wants to merge 1 commit intokeycloakify:mainfrom
zapkub:skip-jar-flag

Conversation

@zapkub
Copy link
Copy Markdown

@zapkub zapkub commented Sep 4, 2025

Introduce a new flag for build command --skip-jar to skip output as jar file and leave the pre-bundle folder.

I would like to submit this change because We use a different tools to bundle JAR output in our build system.

This will allow little flexibility to bundle the final output.

Summary by CodeRabbit

  • New Features
    • Added a --skip-jar option to the build command to skip generating the output JAR.
    • When used, Maven presence checks are bypassed, enabling builds in environments without Maven.
    • Skipping the JAR can speed up development builds; default behavior remains unchanged (JAR is built unless --skip-jar is specified).
    • Clear warning is logged when JAR generation is skipped.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Sep 4, 2025

Walkthrough

Adds a new optional CLI flag (--skip-jar) that propagates to the build command, allowing JAR generation to be skipped. When set, Maven checks are bypassed, jar building is not executed, and resource cleanup behavior is adjusted; otherwise, the existing JAR build and cleanup flow runs.

Changes

Cohort / File(s) Summary
Build command conditional JAR step
src/bin/keycloakify/keycloakify.ts
Adds optional skipJar param to command. Skips Maven presence/installation checks and buildJars(...) when skipJar is true; logs a warning and preserves resources. Otherwise, runs jar build and removes resources as before.
CLI option wiring
src/bin/main.ts
Introduces --skip-jar CLI option (default: false). Extends build command handler to accept skipJar and forwards it to command({ buildContext, skipJar }). Updates option tracking and generic typing for the command.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant U as User
  participant CLI as CLI (build)
  participant KC as keycloakify.command
  participant MVN as Maven
  participant BJ as buildJars

  U->>CLI: run build [--skip-jar]
  CLI->>KC: command({ buildContext, skipJar })

  alt skipJar = true
    KC-->>U: Log "Skipping JAR generation"
    note over KC: Maven check bypassed<br/>No jar build<br/>Resources preserved
  else skipJar = false
    KC->>MVN: Ensure Maven available/installed
    KC->>BJ: buildJars(buildContext)
    BJ-->>KC: JAR artifacts produced
    KC-->>U: Cleanup resources directory
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I twitch my ears at flags that spar,
A hop, a skip—no need for JAR!
Maven naps, the resources stay,
When I choose the skip-jar way.
Carrot logs blink amber bright—
Build still bounds, clean and light.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

add skip-jar flag to skip JAR file build
for the build theme command
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
src/bin/keycloakify/keycloakify.ts (2)

13-15: Nit: destructure skipJar with a default

Slightly cleaner and avoids repeating params. later.

-export async function command(params: { buildContext: BuildContext; skipJar?: boolean }) {
-    const { buildContext } = params;
+export async function command(params: { buildContext: BuildContext; skipJar?: boolean }) {
+    const { buildContext, skipJar = false } = params;

And below:

-        if (params.skipJar) {
+        if (skipJar) {

and

-    if (params.skipJar) {
+    if (skipJar) {

124-136: Skip path behavior looks good; consider guarding against stale files

Leaving resourcesDirPath intact is correct for the flag. If there’s any risk of stale artifacts between runs, optionally pre-clean the directory before regenerating.

Example insertion (after const resourcesDirPath = ... and before generateResources(...)), only if you want a clean slate:

if (skipJar && fs.existsSync(resourcesDirPath)) {
    rmSync(resourcesDirPath, { recursive: true });
}

Also optional: clarify the log to mention Maven check is skipped too:

-`⚠️  --skip-jar passed, skipping the jar building step. ${resourcesDirPath} is left intact.`
+`⚠️  --skip-jar passed: skipping JAR build and Maven check. ${resourcesDirPath} is left intact.`
src/bin/main.ts (1)

71-80: Clarify option description

Make the behavior explicit (bypass Maven check, keep resources).

-        description: "Skip output JAR file generation.",
+        description: "Skip JAR generation; bypass Maven check and leave the pre-bundle resources directory intact.",
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between feeba96 and b5150a7.

📒 Files selected for processing (2)
  • src/bin/keycloakify/keycloakify.ts (2 hunks)
  • src/bin/main.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
src/bin/keycloakify/keycloakify.ts (3)
src/bin/shared/buildContext.ts (1)
  • BuildContext (26-77)
src/bin/keycloakify/buildJars/buildJars.ts (1)
  • buildJars (19-68)
src/bin/tools/fs.rmSync.ts (1)
  • rmSync (9-34)
src/bin/main.ts (2)
src/bin/keycloakify/keycloakify.ts (1)
  • command (13-143)
src/bin/shared/buildContext.ts (1)
  • getBuildContext (132-1066)
🔇 Additional comments (3)
src/bin/keycloakify/keycloakify.ts (1)

17-20: LGTM: Maven check correctly bypassed when --skip-jar is set

This aligns with the flag’s intent and improves UX in environments without Maven.

src/bin/main.ts (2)

67-70: LGTM: build command typed to accept skipJar

Type wiring looks correct.


83-87: LGTM: flag is correctly forwarded to the build command

Propagation is consistent with the new signature.

@zapkub
Copy link
Copy Markdown
Author

zapkub commented Sep 8, 2025

Close and replace by #921

@zapkub zapkub closed this Sep 8, 2025
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.

1 participant