Getting Started
This article outlines the steps to scaffold a new webforJ app using the webforJ archetypes. This archetypes provide a pre-configured project structure and starter code to quickly get a project up and running.
Before you begin, make sure you have reviewed the necessary prerequisites for setting up and using webforJ. This will ensure that you have all the required tools and configurations in place before starting your project.
Using the hello-world
archetype
To create and scaffold a new hello-world
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 thegroupId
,artifactId
, andversion
as needed for your project.
- Bash/Zsh
- PowerShell
- Command Prompt
mvn -B archetype:generate \
-DarchetypeGroupId=com.webforj \
-DarchetypeArtifactId=webforj-archetype-hello-world \
-DarchetypeVersion=LATEST \
-DgroupId=org.example \
-DartifactId=my-app \
-Dversion=1.0-SNAPSHOT \
-DappName=MyApp
mvn -B archetype:generate `
-DarchetypeGroupId="com.webforj" `
-DarchetypeArtifactId="webforj-archetype-hello-world" `
-DarchetypeVersion="LATEST" `
-DgroupId="org.example" `
-DartifactId="my-app" `
-Dversion="1.0-SNAPSHOT" `
-DappName="MyApp"
mvn -B archetype:generate ^
-DarchetypeGroupId="com.webforj" ^
-DarchetypeArtifactId="webforj-archetype-hello-world" ^
-DarchetypeVersion="LATEST" ^
-DgroupId="org.example" ^
-DartifactId="my-app" ^
-Dversion="1.0-SNAPSHOT" ^
-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. |
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.
webforJ comes with several predefined archetypes that help you quickly start your webforJ development. To see a complete list of available archetypes, please refer to the archetypes catalog.
Run the app
Navigate into the newly created directory, and run the following command from the project’s root directory:
mvn jetty:run
This command uses the Jetty maven plugin to start a Jetty server. Once the server is running, open your browser and go to http://localhost:8080 to view the app.
For information on the licensing and the watermark present in unlicensed projects, see this article.