Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Aerogear Scaffolding with AG Controller stuff

1. Install Forge

Instructions can be found here :

2. Install feature branch of ag-controller

AG Controller scaffolding needs some features only available in a branch : Clone this repo :

and check out this branch :

git checkout AEROGEAR-1006

and build:

mvn clean install

3. 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;
field oneToOne --named voucher --fieldType;
@/*cd ../*/;
@/*field oneToMany --named orders --fieldType*/;
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)

4 Start forge


5 Install the Aerogear with controller plugin

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

forge git-plugin git:// --ref ag-controller

6 Run the script

run scaffold.fsh

Just press enter for each prompt (defaults are okay)

7 Build the app

mvn clean install

8 Deploy the App

Enjoy !

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