5.2. Use the Archetypes with the Command Line
You must first generate the project from the archetype using Maven, then you can build the application with Maven and deploy it to a platform. The projects generated by the archetypes are all web applications so you can view the running application in a web browser. The procedures detail the steps for generating, deploying to JBoss EAP and viewing an application.
The procedures assume that JBoss EAP is already installed and Maven is configured to use the JBoss EAP and JBoss Web Framework Kit Maven repositories.
Procedure 5.1. Create a Project from an Archetype Using the Command Line
- On the command line, navigate to the directory where you want to create the project.
- On the command line enter
$ mvn archetype:generate \ -DarchetypeGroupId=org.jboss.archetype.wfk \ -DarchetypeArtifactId=archetype \ -DarchetypeVersion=version.Final
where archetype denotes the unique Artifact Id and version denotes the complete three-digit version number for this JBoss Web Framework Kit release (for example, 2.7.0.Final for JBoss Web Framework Kit 2.7.0). This starts the project generation process, downloading the necessary dependencies, and may take some time to complete. - At the prompts, accept the default values or enter your own values for groupId, artifactId, version and package of the new project. Once generated, the command line output displays
[INFO] BUILD SUCCESS
together with summary information about the build process.
Procedure 5.2. Compile and Deploy an Application using the Command Line
- Compile the Maven-based example to verify it builds successfully
$ mvn compile
- Start JBoss EAP
For Linux and OS X $ EAP_HOME/bin/standalone.sh For Windows $ EAP_HOME\bin\standalone.bat
- Build and deploy the application to JBoss EAP
$ mvn clean install jboss-as:deploy
- View the deployed application in a web browser at http://localhost:8080/application_name/, where application_name is replaced by the name of your application.