2011-10-06

[Update] Create a simple web application with Seam Forge Beta3, JBoss AS 7.0.2 and Metawidget

Here is a little update, because Seam Forge is moving fast. The RichFaces-plugin looks a bit old, I think it's better to add the configuration to the pom.xml without Forge.


Open a command shell and start the JBoss AS with ..\jboss-as-7.0.2.Final\bin\standalone.bat (or standalone.sh within linux)
Start SeamForge in another shell with 'forge' in the forge-1.0.0.Beta3\bin-directory.

[[no project] bin $ cd C:\Users\myuser\workspace
[MyApp] workspace $ new-project --named CoolForge --topLevelPackage de.coolforge --type war
 ? Use [C:\/Users/myuser/workspace/CoolForge] as project directory? [Y/n] Y
***SUCCESS*** Created project [CoolForge] in new working directory
[C:\/Users/myuser/workspace/CoolForge]
...
Wrote C:\/Users/myuser/workspace/CoolForge/src/main/resources/META-INF/forge.xml

[CoolForge] CoolForge $ persistence setup --container JBOSS_AS7 --provider HIBERNATE
***SUCCESS*** Installed [forge.spec.jpa] successfully.
***INFO*** Setting transaction-type="JTA"
***INFO*** Using example data source [java:jboss/datasources/ExampleDS]
 ? The JPA provider [HIBERNATE], also supplies extended APIs. Install these as well? [y/N] N
Wrote C:\/Users/myuser/workspace/CoolForge/pom.xml
Wrote C:\/Users/myuser/workspace/CoolForge/src/main/resources/META-INF/persistence.xml

[CoolForge] CoolForge $ scaffold setup --scaffoldType metawidget
 ? Scaffold provider [metawidget] is not installed. Install it? [Y/n] Y
***SUCCESS*** Installed [forge.spec.cdi] successfully.
***SUCCESS*** Installed [forge.spec.servlet] successfully.
***SUCCESS*** Installed [forge.spec.jsf] successfully.
***SUCCESS*** Installed [metawidget] successfully.
 ? [C:\/Users/myuser/workspace/CoolForge/src/main/webapp/index.html] File exists, overwrite? [Y/n] Y
 ? Your web.xml already contains an error page for 404 status codes, replace it? [Y/n] Y
 ? Your web.xml already contains an error page for 500 status codes, replace it? [Y/n] Y
...
Wrote C:\/Users/myuser/workspace/CoolForge/src/main/webapp/WEB-INF/metawidget.xml

[CoolForge] CoolForge $ entity  --named Person --package de.coolforge.entities
Created @Entity [de.coolforge.entities.Person]
Picked up type : de.coolforge.entities.Person
Wrote C:\/Users/myuser/workspace/CoolForge/src/main/java/de/coolforge/entities/Person.java

[CoolForge] Person.java $ field int --named age
Added field to de.coolforge.entities.Person: @Column private int age;
Wrote C:\/Users/myuser/workspace/CoolForge/src/main/java/de/coolforge/entities/Person.java

[CoolForge] Person.java $ field string --named name
Added field to de.coolforge.entities.Person: @Column private String name;
Wrote C:\/Users/myuser/workspace/CoolForge/src/main/java/de/coolforge/entities/Person.java

[CoolForge] Person.java $ scaffold from-entity
 ? No scaffold type was selected, use default (Metawidget & JSF)? [Y/n]
***SUCCESS*** Generated UI for [de.coolforge.entities.Person]
Wrote C:\/Users/myuser/workspace/CoolForge/src/main/java/de/coolforge/view/PersonBean.java
Wrote C:\/Users/myuser/workspace/CoolForge/src/main/webapp/scaffold/person/view.xhtml
Wrote C:\/Users/myuser/workspace/CoolForge/src/main/webapp/scaffold/person/create.xhtml
Wrote C:\/Users/myuser/workspace/CoolForge/src/main/webapp/scaffold/person/list.xhtml

[CoolForge] Person.java $ build
[INFO] Scanning for projects...
...
***SUCCESS*** Build successful.

[CoolForge] Person.java $ as7 deploy
Wrote C:\/Development/jboss-as-7.0.2.Final/standalone/deployments/CoolForge.war
Deleted C:\/Development/jboss-as-7.0.2.Final/standalone/deployments/CoolForge.war.isdeploying
***SUCCESS*** Deployed [CoolForge.war] to [C:\/Development/jboss-as-7.0.2.Final/standalone/deployments]

That should deploy your application. There is an issue with the error pages, you can fix that in the web.xml by rename 404/500.jsf to .html. Or maybe you answer this questions with no(I didn't tried it):


? Your web.xml already contains an error page for 404 status codes, replace it? [Y/n] n
? Your web.xml already contains an error page for 500 status codes, replace it? [Y/n] n

Type 'http://localhost:8080/CoolForge/ in your browser...