Project Wizard (cb --new)

The project wizard creates new projects interactively. It guides you through product selection, project type selection, and project-specific configuration.

🤝

Works hand in hand with its sister project common-gradle-build — for Gradle-based project types the wizard uses common-gradle-build to generate and build the project. They can be combined to get a complete development environment with tool management and build automation.

Quick Start

cb --new

You can also prefill all wizard parameters from the command line:

cb --new [product-id] [project-type-id] [project-name] [package-name] [group-id] [component-id] [description...]

Example:

cb --new 1 1 my-service com.example.myservice example mycomp "A REST API service"

Wizard Flow

1. Product Selection (optional)

If a product-types.properties file exists, the wizard displays a numbered list of products:

[1] My product
[2] Another product

Selecting a product pre-fills wizard defaults (group ID, component ID, root package name, etc.) so you don't have to enter them manually for every project.

If no product-types.properties exists, this step is skipped.

2. Project Type Selection

The wizard displays all available project types:

[1]  Simple java application
[2]  Simple java library
[3]  Configuration project
[4]  Script project
...

The selected project type determines which fields are prompted and what actions are executed.

3. Project Details

Depending on the selected project type, the wizard prompts for some or all of the following:

FieldDescription
Project NameThe project directory and artifact name. Some types append a suffix automatically (e.g. -ui, -config).
Root Package NameJava package name (e.g. com.example.myproject). Only for Java-based types.
Group IDArtifact group identifier, typically used for Maven/Gradle publishing.
Component IDOptional component identifier that can be part of the project name.
DescriptionA short project description. Defaults to "The implementation of the {projectName}."

4. Project Generation

After collecting input, the wizard:

  1. Installs dependencies if the project type defines an install section (e.g. node).
  2. Runs the init action if defined (e.g. npx create-react-app).
  3. Runs the main action if defined. If no main action is set, the wizard creates a build.gradle using common-gradle-build and runs Gradle.
  4. Runs the post action if defined (e.g. cleanup tasks).

Configuration

product-types.properties

Defines organizational product groupings. Each product pre-fills wizard fields.

Location: conf/product-types.properties (see conf/product-types-sample.properties for a template)

Syntax:

<product-name> = <setting> [ | <setting> ]

Each setting is a variableName:value pair. Multiple settings are separated by |.

Example:

My product = projectComponentId:myc|projectGroupId:myg|projectRootPackageName:myc.rootpackage.name

When this product is selected, the wizard pre-fills:

project-types.properties

Defines available project types and their wizard configuration.

Location: conf/project-types.properties

Syntax:

<project-type-id> = <description> [ | <configuration-section> ]

Configuration sections control which fields are prompted and what actions are run:

SectionDescription
projectNamePrompt for project name. Append =<suffix> to auto-add a suffix (e.g. projectName=-ui).
projectRootPackageNamePrompt for Java root package name.
projectGroupIdPrompt for group ID.
projectComponentIdPrompt for component ID.
projectDescriptionPrompt for project description.
install=<pkg1>[,<pkg2>]Install dependencies before project creation (e.g. install=node).
initAction=<command>Run a command before the main project generation.
mainAction=<command>Run as the main generation step. If empty, common-gradle-build is used.
postAction=<command>Run a command after project generation (e.g. cleanup).

Important: The order of sections matters. install, initAction, mainAction, and postAction must appear after the field sections.

Parameter substitution in actions — the following tokens are replaced at runtime:

TokenReplaced with
@@projectName@@Entered project name
@@projectType@@Selected project type
@@projectRootPackageName@@Entered root package name
@@projectGroupId@@Entered group ID
@@projectComponentId@@Entered component ID
@@projectDescription@@Entered description
@@logFile@@/dev/null (Linux/Mac) or nul (Windows)
@@delete@@rm -rf (Linux/Mac) or cb-deltree (Windows)

Available Project Types

TypeDescriptionSuffixFieldsDependencies
java-applicationSimple java applicationname, package, group, component, description
java-librarySimple java libraryname, package, group, component, description
configConfiguration project-configname, group, component, description
scriptScript project-binname, group, description
openapiOpenAPI definition project-service-api-specname, package, group, component, description
quarkusREST-service with Quarkus-servicename, package, group, component, description
vuejsVue-uiname, component, descriptionnode
nuxtjsNuxt-uiname, component, descriptionnode
reactReact-uiname, component, descriptionnode
kubernetes-productKubernetes product-appname, group, component, description
documentationDocumentation project-documentationname, group, description
containerIndividual container (e.g. docker)-containername, component, description
organization-configCommon Organization Config-configname, group, description

Configuration File Resolution

The wizard searches for configuration files in this order (first found wins):

  1. Custom runtime config$CB_CUSTOM_RUNTIME_CONFIG_PATH/conf/
  2. Local common-gradle-build~/.gradle/common-gradle-build/<version>/gradle/conf/
  3. Default$CB_HOME/conf/

This allows organizations to provide their own product and project types via a custom config project.

Examples

Create a Java library interactively:

cb --new
# Select: java-library
# Enter: project name, package, group, component, description

Create a Vue.js project (installs Node automatically):

cb --new
# Select: vuejs
# Enter: project name, component, description

Fully scripted project creation:

cb --new 1 1 my-service com.example.myservice example mycomp "My new service"

GNU General Public License v3.0 — see LICENSE for details.

← Back