-
Download Forge 1.3.0.Final http://forge.jboss.org/index.html
-
Unpack Forge
-
In JBoss Tools, in Forge preferences, point to the fresh installed Forge folder.
-
Start the forge console and install the Aerogear Scaffold plugin :
forge git-plugin git://github.com/aerogear/aerogear-forge-scaffold --ref minidemo
The Scaffold plugin depends on a version which is not yet available on the maven repos.
-
Clone Aerogear Controller
https://github.com/aerogear/aerogear-controller
-
Install
mvn clean install
-
In JBoss Tools make sure the Embedded Maven is linked to your settings.xml that contains the JBoss repositories.
-
Make sure you have a running instance of AS7.
-
Prepare you forge script by saving this where ever you want and name it as you want, i.e scaffold.fsh
new-project --named blogapp;
persistence setup --provider HIBERNATE --container JBOSS_AS7;
validation setup --provider JAVA_EE;
entity --named Post;
field string --named title;
field string --named content;
rest setup --activatorType WEB_XML;
rest endpoint-from-entity --contentType application/json com.example.blogapp.model.*;
scaffold setup --scaffoldType html5-aerogear;
- In the console, run the forge script
run pathToYourScript/scaffold.fsh
This will create a JEE app with persistence, REST enpoints. You should also see at the root of the project a file named config.json.
-
Assuming you have already created a empty Cordova app, edit the config.json and under "Cordova" , fill in the "appPath" which is the path to your Cordova project (no need to point to the subfolder www).
-
The second thing to change is the baseURL (Needed for the cordova app to communicate with the backend). Be sure to use an network IP and not your local IP ;) , for instance :
"baseURL" : "http://192.168.1.19:8080/blogapp"
-
Scaffold the App !
scaffold from-entity com.example.blogapp.model.*;
-
Setup AS7
as7 setup
-
Deploy the app
as7 deploy
-
Start your Cordova App !