What is it?
This quickstart demonstrates how to create a fully Java EE compliant project using nothing but JBoss Forge.
Once generated, the sample project will be a standard Maven 3, Java Web project with JPA 2.0, EJB 3.1, CDI 1.0, JSF 2.0 with complete JAX-RS endpoints for all data Entities. It will also provide views to Create, Read, Update, and Delete records.
But that is not all! You can use Forge on your new or existing projects to continue to enhance any application.
System requirements
The application this project produces is designed to be run on JBoss Enterprise Application Platform 6 or JBoss AS 7.
All you need to build this project is Java 6.0 (Java SDK 1.6) or better, and an JBoss Developer Studio 5 or JBoss Forge version 1.0.0.Final (or higher).
JBoss Enterprise Application Platform 6
If you are using JBoss Enterprise Application Platform 6, Forge is available in JBoss Developer Studio 5.
To show the Forge Console, navigate to Window -> Show View -> Other, locate Forge Console and click OK. Then click the Start button in top right corner of the view.
JBoss AS 7
If you are using JBoss AS 7, you should install JBoss Forge version 1.0.0.Final or higher. Follow the instructions at Installing Forge.
Open a command line and navigate to the root directory of this quickstart.
Launch Forge by typing the following command:
forge
Generate, Build, and Deploy the Application
In the Forge console, make sure you are in the directory where this README.md file is located:
forge> cd QUICKSTART_HOME/forge-from-scratch/
Notice that there is a file in this directory named generate.fsh. Run this file from Forge using the run command:
forge> run generate.fsh
This command will prompt you to enter a project-name, for example: 'example'
After this, you see a lot of console messages with a [INFO] BUILD SUCCESS towards the end.
What Did This Create?
This quickstart has created a native Java EE 6 application.
After this command completes, look in your QUICKSTART_HOME/forge-from-scratch/ folder. You will see a folder with the same name as the project-name you entered in the prompt above. Browse through this project to see the code that was generated as a result of this command.
For a full description of what was generated by running this script and details on the structure of the application, visit the Forge UI Scaffolding Guide
Configure Maven
If you have not yet done so, you must Configure Maven before testing the quickstarts.
NOTE: If you are using JBoss Enterprise Application Platform 6, you can not append the path to the Maven settings on the Forge command line. You must configure the Maven user settings as noted in step 4 of the instructions.
Start JBoss Enterprise Application Platform 6 or JBoss AS 7 with the Web Profile
- Open a command line and navigate to the root of the JBoss server directory.
-
The following shows the command line to start the server with the web profile:
For Linux: JBOSS_HOME/bin/standalone.sh For Windows: JBOSS_HOME\bin\standalone.bat
Deploy and test the newly generated application
Make sure you have started the JBoss server. See the instructions in the previous section.
-
Build the application:
forge> build -
Use the
jboss-as-7Forge plugin to deploy the application. Install it with the following command:forge> forge install-plugin jboss-as-7 -
Configure the server information:
forge> as7 setupYou will be prompted with three questions. Type 'N' for the first two questions to keep the default settings. Enter the path to your server install for the third question.
-
Now deploy the application:
forge> as7 deployThis will deploy
target/YOUR_PROJECT_NAME.war. -
The application will be running at the following URL: http://localhost:8080/YOUR_PROJECT_NAME/.
Be sure to replace
YOUR_PROJECT_NAMEwith the name of the project you chose when running the script. -
When you are ready to undeploy from JBoss AS, run this command:
forge> as7 undeploy
Next Steps
Open generate.fsh and take a look inside! There is not much magic happening here. All of the commands used to generate this project are clearly listed just as if they were typed by your own hands.
Play around with creating more entities, relationships, UI, and generating JAX-RS endpoints,all with just a few simple commands.
Explore plugins!
Forge has a rich plugin ecosystem. Want to deploy your application to the Cloud? Use the Forge Openshift Express plugin: http://github.com/forge/plugin-openshift-express/
To see a full list of avaialable plugins, make sure that you have an active internet connection and type:
forge> forge find-plugin *
Run the Quickstart in JBoss Developer Studio or Eclipse
You can also start the server and deploy the quickstarts from Eclipse using JBoss tools. For more information, see Use JBoss Developer Studio or Eclipse to Run the Quickstarts
Debug the Application
If you want to debug the source code or look at the Javadocs of any library in the project, run either of the following commands to pull them into your local repository. The IDE should then detect them.
mvn dependency:sources
mvn dependency:resolve -Dclassifier=javadoc
Share the Knowledge
Find this guide useful?
Feedback
Find a bug in the guide? Something missing? You can fix it by forking the repository, making the correction and sending a pull request. If you're just plain stuck, feel free to ask a question in the user discussion forum.
Recent Changelog
- Feb 14, 2013: Partial fix for bug 911090: instruction update Sande Gilda
- Feb 12, 2013: Add quickstart source repository of record to the readme files Sande Gilda
- Sep 11, 2012: Add target product (https://issues.jboss.org/browse/jdf-108) Sande Gilda
- May 11, 2012: Readme maven config updates, change header titles to quickstart folder name, update experience levels, issue 258 Sande Gilda
- May 18, 2012: Move metadata to quickstarts Pete Muir
- Apr 11, 2012: Remove odd trailing slashes Pete Muir
- Apr 10, 2012: Solve issue #194 :-) auto transform links from readme.md -> readme.html Pete Muir
- Apr 05, 2012: Missed adding the arquillian instructions, fixed indentations, modified jta-crash-rec and jts-distributed-crash-rec, add missing authors Sande Gilda
- Apr 05, 2012: Add maven configuration instructions for eap6: issue 190 and jbpapp-8293 Sande Gilda
- Apr 01, 2012: More readme cleanup Sande Gilda
- Mar 26, 2012: Attempt to standardize readme.md files Sande Gilda
- Mar 22, 2012: Include eap / jbds instructions Pete Muir
- Feb 01, 2012: Modified the readme to point them to the folder that was created as a result of running the script Sande Gilda
- Jan 12, 2012: Added jboss forge quickstart from scratch Lincoln Baxter, III