Tabs archetype
The tabs starting project generates an app with a simple tabbed interface. Ideal for projects that require multiple views or sections accessible via tabs, this archetype provides a clean and organized way to manage different parts of your app, making it easy to navigate between various sections without cluttering the user interface.
For more control over customization and configuration, you can use startforJ to create your project - just select the Tabs archetype when choosing configuration options.
Using the tabs archetype
To create and scaffold a new tabs project, follow these steps:
- Navigate to the proper directory: Open a terminal and move to the folder where you want to create your new project.
- Run the archetype:generate command: Use the Maven command below, and customize the groupId, artifactId, and version as needed for your project.
- Bash/Zsh
- PowerShell
- Command Prompt
mvn -B archetype:generate \
-DarchetypeGroupId=com.webforj \
-DarchetypeArtifactId=webforj-archetype-tabs \
-DarchetypeVersion=LATEST \
-DgroupId=org.example \
-DartifactId=my-app \
-Dversion=1.0-SNAPSHOT \
-Dflavor=webforj \
-DappName=MyApp
mvn -B archetype:generate `
-DarchetypeGroupId="com.webforj" `
-DarchetypeArtifactId="webforj-archetype-tabs" `
-DarchetypeVersion="LATEST" `
-DgroupId="org.example" `
-DartifactId="my-app" `
-Dversion="1.0-SNAPSHOT" `
-Dflavor="webforj" `
-DappName="MyApp"
mvn -B archetype:generate ^
-DarchetypeGroupId="com.webforj" ^
-DarchetypeArtifactId="webforj-archetype-tabs" ^
-DarchetypeVersion="LATEST" ^
-DgroupId="org.example" ^
-DartifactId="my-app" ^
-Dversion="1.0-SNAPSHOT" ^
-Dflavor="webforj" ^
-DappName="MyApp"
| Argument | Explanation |
|---|---|
archetypeGroupId | The group ID of the archetype is com.webforj for webforJ archetypes. |
archetypeArtifactId | Specifies the name of the archetype to use. |
archetypeVersion | Specifies the version of the archetype to use. This ensures that the generated project is compatible with a specific archetype version. Using LATEST selects the most recent version available. |
groupId | Represents the namespace for the generated project. Typically structured like a Java package, such as org.example and is used to uniquely identify your organization or project domain. |
artifactId | Specifies the name of the generated project. This will be the name of the resulting artifact and the project folder. |
version | Defines the version of the generated project. A common convention is MAJOR.MINOR-SNAPSHOT, like 1.0-SNAPSHOT, where SNAPSHOT denotes that the project is still in development. |
flavor | Selects a project flavor:
|
appName | An optional parameter that can be used in the generated project's POM file. Depending on the used webforJ archetype, it can be utilized as a default title for the application. |
After running the command, Maven will generate the project files necessary to run the project.
Running the app
Before running your app, install the prerequisites if you haven't yet. Then, navigate to the project's root directory and run the following command:
mvn
The shorthand mvn command works because the archetype's POM file includes a <defaultGoal> configuration that automatically runs the appropriate goal for your project type. If your project doesn't have <defaultGoal>, run the following:
# for a standard webforJ app
mvn jetty:run
# for a webforJ + Spring Boot app
mvn spring-boot:run
Once the server is running, open your browser and go to http://localhost:8080 to view the app.