Archétype des onglets
Le projet de démarrage tabs génère une application avec une interface à onglets simple. Idéal pour les projets nécessitant plusieurs vues ou sections accessibles via des onglets, cet archétype fournit un moyen clair et organisé de gérer différentes parties de votre application, facilitant ainsi la navigation entre les différentes sections sans encombrer l'interface utilisateur.
Pour un meilleur contrôle sur la personnalisation et la configuration, vous pouvez utiliser startforJ pour créer votre projet - il vous suffit de sélectionner l'archétype Tabs lors du choix des options de configuration.
Utilisation de l'archétype tabs
Pour créer et mettre en place un nouveau projet tabs, suivez ces étapes :
- Naviguez vers le répertoire approprié: Ouvrez un terminal et déplacez-vous dans le dossier où vous souhaitez créer votre nouveau projet.
- Exécuter la commande archetype:generate: Utilisez la commande Maven ci-dessous et personnalisez le groupId, l'artifactId et la version selon les besoins de votre projet.
- 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 | Explication |
|---|---|
archetypeGroupId | L'ID de groupe de l'archétype est com.webforj pour les archétypes webforJ. |
archetypeArtifactId | Spécifie le nom de l'archétype à utiliser. |
archetypeVersion | Spécifie la version de l'archétype à utiliser. Cela garantit que le projet généré est compatible avec une version d'archétype spécifique. Utiliser LATEST sélectionne la version la plus récente disponible. |
groupId | Représente l'espace de nom du projet généré. Généralement structuré comme un package Java, par exemple org.example, et est utilisé pour identifier de manière unique votre organisation ou domaine de projet. |
artifactId | Spécifie le nom du projet généré. Ce sera le nom de l'artifact résultant et du dossier du projet. |
version | Définit la version du projet généré. Une convention courante est MAJOR.MINOR-SNAPSHOT, comme 1.0-SNAPSHOT, où SNAPSHOT indique que le projet est encore en développement. |
flavor | Sélectionnez un type de projet :
|
appName | Un paramètre optionnel pouvant être utilisé dans le fichier POM du projet généré. Selon l'archétype webforJ utilisé, il peut servir de titre par défaut pour l'application. |
Après l'exécution de la commande, Maven générera les fichiers de projet nécessaires pour exécuter le projet.
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.