This topic tells you how to bootstrap a new app using an Application Accelerator.
Before you begin
Before you can bootstrap an app using an accelerator, you must:
-
Install the Tanzu CLI
app-developer
plug-in group, if it is not present, by running:tanzu plugin install --group vmware-tanzu/app-developer
-
Log in from the Tanzu CLI by running:
tanzu login
-
Set the Project to use by running:
tanzu project use
-
Obtain an active Tanzu context for the Tanzu CLI and set the Tanzu Project to use.
- Install the Tanzu Platform Developer Tools plug-in for IntelliJ.
- Have accelerators available for the Tanzu Project. For how to install provided samples, see Publish the sample resources to the Tanzu Project.
Generate a new project
Generate a new project either by using the IntelliJ IDE or the accelerator
Tanzu CLI plug-in.
Generate a new project by using the IntelliJ IDE
To generate a new project by using the IntelliJ IDE:
-
Open the New Project Wizard in IntelliJ.
-
Under Generators on the left side, click Tanzu Application Accelerator. The first step of the wizard opens and shows a loading indicator as it attempts to fetch a list of accelerators. If successful, accelerators are displayed.
-
Click on an accelerator and then click Next.
-
Use the default option values for the accelerator or edit them, and then click Next.
-
(Optional) Your home directory is the default location in which to generate the new project. Change this location to the path for the workspace where you keep your source code.
-
Review the selections in the next step, and then click Next to generate the project.
You can save the options used for generating a project as a JSON file. This file can later be used with the Tanzu CLI accelerator plug-in
generate
command to generate a new project from the CLI. - A message appears indicating that the project was generated. Click Create to open the project. The newly generated project appears in the IDE.
Generate a new project by using the accelerator Tanzu CLI plug-in
To generate a new project by using the accelerator
Tanzu CLI plug-in:
-
Ensure that the Accelerator Local Server engine is running either as a separate process or as part of the Tanzu Platform Developer Tools plug-in for IntelliJ IDE.
-
If you have not done so already, get an active Tanzu context for the Tanzu CLI and set the Tanzu UCP Project to use.
-
Listing the available accelerators by running:
tanzu accelerator list
A list similar to this appears:
NAME TAGS DISPLAY NAME spring-ai-chat [java spring web ai tanzu] Tanzu Spring AI RAG App spring-music [java spring cloud music tanzu] Spring Music tanzu-java-web-app [java spring gradle maven web tanzu] Tanzu Java Web App
-
Review the available options for an accelerator by running:
tanzu accelerator get tanzu-java-web-app
Options available for the accelerator appear:
name: tanzu-java-web-app description: A sample Spring Boot web application for Tanzu Platform for Kubernetes displayName: Tanzu Java Web App sourceURL: https://github.com/vmware-tanzu/application-accelerator-samples/tree/main/tanzu-java-web-app tags: - java - spring - gradle - maven - web - tanzu options: - name: buildTool label: Build Tool required: true inputType: select dataType: string defaultValue: maven choices: - text: Maven (https://maven.apache.org/) value: maven - text: Gradle (https://gradle.org/) value: gradle - name: javaVersion label: Java version to use inputType: select dataType: string defaultValue: "17" choices: - text: Java 17 value: "17" - text: Java 21 value: "21" - name: includeBuildToolWrapper label: Include Build Tool wrapper support inputType: checkbox dataType: boolean defaultValue: true
The
generate
command takes the following flags:Flags: --extract extract the generated content in output-dir -f, --force force overwrite of zip file or generated content directory -h, --help help for generate --options string options JSON string (default "{}") --options-file string path to file containing options JSON string -o, --output-dir string directory that the zip file or generated content will be written to
-
Generate a new project by running:
tanzu accelerator generate tanzu-java-web-app --extract --options-file ./my-options.json
Here is an example of an options file named
my-options.json
:{ "includeBuildToolWrapper" : true, "javaVersion" : "21", "buildTool" : "maven", "projectName" : "my-java-web-app" }
You only need to provide options where you want to override the default values.
This command creates the project directory
my-java-web-app
under the current directory. The directory is named based on theprojectName
option. To use a different name for the project directory, use the--output-dir
flag. If you omit the--extract
flag, the project is generated as a ZIP file named with theprojectName
option.When using the
generate
command you can either:- Provide the options in a JSON file with the
--options-file
flag, as in the command here. - Provide the options as a JSON-formatted string by using the
--options
flag.
The IntelliJ plug-in has a feature for saving options provided for generating a new project as a JSON file. This file can now be used with the
generate
command. - Provide the options in a JSON file with the
Content feedback and comments