Skip to content

Instantly share code, notes, and snippets.

@sebastienblanc
Last active December 13, 2015 19:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sebastienblanc/4961324 to your computer and use it in GitHub Desktop.
Save sebastienblanc/4961324 to your computer and use it in GitHub Desktop.

1. Install Forge

Instructions can be found here : http://forge.jboss.org/docs/using/

2. Create a Forge script

To go faster and avoid typing too much commands you can use a forge script, copy/paste the following in a text file and save it as scaffold.fsh (or whatever name you want)

new-project --named scaffoldtester;
persistence setup --provider HIBERNATE --container JBOSS_AS7;
validation setup --provider JAVA_EE;
entity --named Customer;
field string --named firstName;
field temporal --type DATE --named dateOfBirth;
entity --named DiscountVoucher;
field string --named voucherCode;
entity --named StoreOrder;
field string --named product;
field int --named amount;
constraint Min --onProperty amount --min 1;
constraint Max --onProperty amount --max 50;
field string --named remarks;
constraint Size --onProperty remarks --max 100;
field manyToOne --named customer --fieldType com.example.scaffoldtester.model.Customer.java;
field oneToOne --named voucher --fieldType com.example.scaffoldtester.model.DiscountVoucher.java;
@/*cd ../Customer.java*/;
@/*field oneToMany --named orders --fieldType com.example.scaffoldtester.model.StoreOrder.java*/;
rest setup --activatorType WEB_XML;
rest endpoint-from-entity --contentType application/json com.example.scaffoldtester.model.*;
scaffold setup --scaffoldType html5-aerogear;
scaffold from-entity com.example.scaffoldtester.model.*;

Please feel free after a first test to change the values, names, relations but try to keep consistent in the package naming (remember COC)

3 Start forge

forge

4 Install the Aerogear plugin

Once in the Forge Shell type (forge is part of the command to type) :

forge git-plugin git://github.com/sebastienblanc/scaffold-html5 --ref scaffold-aerogear

5 Run the script

run scaffold.fsh

Just press enter for each prompt (defaults are okay)

6 Build the app

mvn clean install

7 Deploy the App

Enjoy !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment