themes/├── package.json # Keycloakify dependencies├── vite.config.ts # Vite + Keycloakify plugin config├── tsconfig.json # TypeScript config├── src/│ ├── main.tsx # Entry point│ └── keycloak-theme/│ └── login/│ └── Login.tsx # Sample login page├── README.md # Theme documentation└── .gitignore# Use the official starter insteadrm -rf themes/git clone https://github.com/keycloakify/keycloakify-starter.git themescd themesnpm installnpm run build-keycloak-themecd ..# Build themes and Docker image./build-themes.shdocker build -t keycloak .docker run -p 8080:8080 keycloakrm -rf themes/git clone https://github.com/keycloakify/keycloakify-starter.git themescd themesnpm installnpm run build-keycloak-themebrew install maven # macOScd themesnpm run build-keycloak-theme"build-keycloak-theme": "npm run build && keycloakify build"exec /Users/josh/terydin/keycloak/mvnw "$@"import * as fs from "fs";import * as path from "path";
export function getMavenCommand(params: { projectDirPath: string }): string { const { projectDirPath } = params;
// Check for Maven wrapper first const mvnwUnix = path.join(projectDirPath, "mvnw"); const mvnwWindows = path.join(projectDirPath, "mvnw.cmd");
if (fs.existsSync(mvnwUnix)) { return `"${mvnwUnix}"`; }
if (fs.existsSync(mvnwWindows)) { return `"${mvnwWindows}"`; }
// Fall back to system Maven return "mvn";}import { getMavenCommand } from "../tools/getMavenCommand";
// In the command function, replace the exit_if_maven_not_installed block:exit_if_maven_not_installed: { let commandOutput: Buffer | undefined = undefined; const mavenCmd = getMavenCommand({ projectDirPath: buildContext.projectDirPath });
try { commandOutput = child_process.execSync(`${mavenCmd} --version`, { stdio: ["ignore", "pipe", "ignore"], cwd: buildContext.projectDirPath }); } catch {}
if (commandOutput?.toString("utf8").includes("Apache Maven")) { break exit_if_maven_not_installed; }
// Update error message console.log( `${chalk.red("Apache Maven required.")} Install it with \`${chalk.bold( installationCommand )}\` (for example) or add the Maven wrapper (mvnw) to your project.` ); process.exit(1);}import { getMavenCommand } from "../../tools/getMavenCommand";
// In the buildJar function, replace the mvnBuildCmd:{ const useDefaultMavenRepo = process.env.KEYCLOAKIFY_USE_DEFAULT_MAVEN_REPO === "true"; const mavenLocalRepoArg = useDefaultMavenRepo ? "" : `-Dmaven.repo.local="${pathJoin(buildContext.cacheDirPath, ".m2")}"`; // Get Maven command (wrapper or system) const mavenCmd = getMavenCommand({ projectDirPath: buildContext.projectDirPath }); const mvnBuildCmd = `${mavenCmd} -B -ntp clean install ${mavenLocalRepoArg}`.trim();
await new Promise<void>((resolve, reject) => child_process.exec( mvnBuildCmd, { cwd: keycloakifyBuildCacheDirPath, env: { ...process.env, MAVEN_OPTS: [process.env.MAVEN_OPTS, "-Xmx4096m"] .filter(x => !!x) .join(" ") } }, // ... rest of the code ) );}## Feature: Add Maven Wrapper Support
This PR adds support for the Maven Wrapper (`mvnw`) to Keycloakify. Projects can now use `./mvnw` instead of requiring a system-wide Maven installation.
### Changes- Added `getMavenCommand()` utility to detect Maven wrapper- Checks for `mvnw` (Unix) or `mvnw.cmd` (Windows) in project directory- Falls back to system `mvn` if wrapper not found- Maintains backward compatibility
### Benefits- No need to install Maven globally on CI/CD systems- Consistent Maven versions across team members- Follows Java ecosystem best practices
### Testing- [ ] Test with mvnw present- [ ] Test without mvnw (falls back to mvn)- [ ] Test on Windowscreate-keycloakify/├── bin/│ └── cli.js # Main CLI with interactive prompts├── templates/│ ├── base/ # Minimal Keycloakify project│ │ ├── src/│ │ ├── package.json│ │ ├── vite.config.ts│ │ ├── tsconfig.json│ │ ├── index.html│ │ ├── .gitignore│ │ └── README.md│ ├── docker/│ │ └── Dockerfile # Keycloak Dockerfile template│ └── maven-wrapper/│ └── .mvn/ # Maven wrapper files├── package.json└── README.mdcd ~/dev/create-keycloakifynode bin/cli.jscd ~/dev/create-keycloakifynpm linkcreate-keycloakifycd ~/dev/create-keycloakifynpm loginnpm publishnpx create-keycloakify