forge-from-scratch quickstart demonstrates how to create a fully Java EE compliant project using JBoss Forge 2 and Red Hat JBoss Developer Studio 8 or later and deploy it to Red Hat JBoss Enterprise Application Platform 6.4 or later.
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.1 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.
Note: This quickstart uses the H2 database included with Red Hat JBoss Enterprise Application Platform 6. It is a lightweight, relational example datasource that is used for examples only. It is not robust or scalable, is not supported, and should NOT be used in a production environment!
The application this project produces is designed to be run on Red Hat JBoss Enterprise Application Platform 6.4 or later.
All you need to build this project is Java 7.0 (Java SDK 1.7) or later and Red Hat JBoss Developer Studio 8 or greater.
If you have not yet done so, you must Configure Maven - For Use with JBoss Developer Studio before testing the quickstarts.
Forge is available in JBoss Developer Studio. To run this example, you must use JBoss Developer Studio 8 or greater.
Forge ConsoleWindow. To open it, navigate to menu item Window -> Show View -> Other. Locate Forge -> Forge Console and click OK.
In the Forge Console Window, navigate to the root directory of this quickstart.
$ cd QUICKSTART_HOME/forge-from-scratch/
Notice there is a file in this directory named
generate.fsh. Run this file from the Forge console using the
$ run generate.fsh
$ project-new --named forge-example --topLevelPackage org.example;
***SUCCESS*** Project named 'forge-example' has been created.
User Operation is waiting for "Importing Forge project" to complete..
***SUCCESS***messages, you see
[INFO] BUILD SUCCESSnear the end of the console output.
This quickstart created a native Java EE 6 application.
QUICKSTART_HOME/forge-from-scratch/folder. You see a folder with the name
Project Explorerview in JBoss Developer Studio.
Run on Server. If you have more than one server, choose the JBoss EAP 6.4 Runtime server.
Note: You will see the following warnings in the server log. You can ignore these warnings.
HHH000059: Defining hibernate.transaction.flush_before_completion=true ignored in HEM HHH000431: Unable to determine H2 database version, certain features may not work
The application appears in a 'Welcome to Forge' Window and displays the following:
Welcome to Forge Your application is running.
The following entities are displayed on the lower left side of the page:
When you click on an entity, you are provided with a form that allows you to:
The running application also provides links to find more information about the Forge.
When you are ready to undeploy the application from JBoss EAP:
forge-exampleproject created by this quickstart, right-click, and choose
OK when asked if you are sure you want to remove resource from the server. You should see the following message:
INFO [org.jboss.as.server] (DeploymentScanner-threads - 1) JBAS018558: Undeployed "forge-example.war" (runtime-name: "forge-example.war")
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.