Overblog
Editer l'article Suivre ce blog Administration + Créer mon blog
21 mai 2008 3 21 /05 /mai /2008 13:49

Voici la suite du Tutorial sur Seam. Après avoir vue l'installation de seam dans Installer Seam et JBoss, voyons comment créer un projet seam dans eclipse.

Créer un projet Seam

 

 

1 - Setup de Seam

Aller dans REP_WORKSPACE/-seam-2.0.1.GA  avec l’invite de commande Windows

Tapez seam setup puis enter

 

Voici ce que j’obtiens sur mon pc :

C:devjavaworkspacejboss-seam-2.0.1.GA>seam setup

Buildfile: C:devjavaworkspacejboss-seam-2.0.1.GAseam-genbuil

d.xml

init:

setup:

[echo] Welcome to seam-gen :-)

[input] Enter your Java project workspace (the directory that contains your

Seam projects) [C:/Projects] [C:/Projects]

E:/DavidDate/DevNuts/ProjetsEclipse

[input] Enter your JBoss home directory [C:/Program Files/jboss-4.2.2.GA] [C

:/Program Files/jboss-4.2.2.GA]

[input] Enter the project name [myproject] [myproject]

helloworld

[echo] Accepted project name as: helloworld

[input] Do you want to use ICEFaces instead of RichFaces [n] (y, [n], )

n

[input] skipping input as property icefaces.home.new has already been set.

[input] Select a RichFaces skin [blueSky] ([blueSky], classic, ruby, wine, d

eepMarine, emeraldTown, sakura, DEFAULT)

[input] Is this project deployed as an EAR (with EJB components) or a WAR (w

ith no EJB support) [ear] ([ear], war, )

[input] Enter the Java package name for your session beans [com.mydomain.hel

loworld] [com.mydomain.helloworld]

com.getj2ee.tuto.seam.helloworld

[input] Enter the Java package name for your entity beans [com.getj2ee.tuto.

seam.helloworld] [com.getj2ee.tuto.seam.helloworld]

 

[input] Enter the Java package name for your test cases [com.getj2ee.tuto.se

am.helloworld.test] [com.getj2ee.tuto.seam.helloworld.test]

[input] What kind of database are you using? [hsql] ([hsql], mysql, oracle,

postgres, mssql, db2, sybase, enterprisedb, h2)

[input] Enter the Hibernate dialect for your database [org.hibernate.dialect

.HSQLDialect] [org.hibernate.dialect.HSQLDialect]

[input] Enter the filesystem path to the JDBC driver jar [lib/hsqldb.jar] [l

ib/hsqldb.jar]

[input] Enter JDBC driver class for your database [org.hsqldb.jdbcDriver] [o

rg.hsqldb.jdbcDriver]

[input] Enter the JDBC URL for your database [jdbc:hsqldb:.] [jdbc:hsqldb:.]

[input] Enter database username [sa] [sa]

[input] Enter database password [] []

[input] Enter the database schema name (it is OK to leave this blank) [] []

[input] Enter the database catalog name (it is OK to leave this blank) [] []

[input] Are you working with tables that already exist in the database? [n]

(y, [n], )

[input] Do you want to drop and recreate the database tables and data in imp

ort.sql each time you deploy? [n] (y, [n], )

[propertyfile] Creating new property file: C:devjavaworkspacej

boss-seam-2.0.1.GAseam-genbuild.properties

[echo] Installing JDBC driver jar to JBoss server

[copy] Copying 1 file to C:Program Filesjboss-4.2.2.GAserverdefaultlib

[echo] Type 'seam create-project' to create the new project

BUILD SUCCESSFUL

Total time: 6 minutes 27 seconds

C:devjavaworkspacejboss-seam-2.0.1.GA>

 

 

Seam est correctement installé.

 

2 - Création du projet dans Eclipse.

Pour il faut maintenant taper seam new-project

Vous allez obtenir ceci :

 

C:devjavaworkspacejboss-seam-2.0.1.GA>seam new-project

Unable to locate tools.jar. Expected to find it in C:Program FilesJavajre1.6.

0_04libtools.jar

Buildfile: C:devjavaworkspacejboss-seam-2.0.1.GAseam-genbuil

d.xml

 

init:

 

init-properties:

[echo] C:/Program Files/jboss-4.2.2.GA

 

validate-workspace:

 

validate-project:

 

icefaces-staging-copy:

 

initcopy:

 

initpoms:

[echo] Setting up dependencies

[mkdir] Created dir: C:devjavaworkspacejboss-seam-2.0.1.GA

classespoms

[copy] Copying 1 file to C:devjavaworkspacejboss-seam-2.0

.1.GAclassespoms

[artifact:install] [INFO] Installing C:devjavaworkspacejboss-s

eam-2.0.1.GAclassespomsroot.pom to C:Usersdavidgimelle.m2repositoryorgj

bossseamroot2.0.1.GAroot-2.0.1.GA.pom

[copy] Copying 1 file to C:devjavaworkspacejboss-seam-2.0

.1.GAclassespoms

[artifact:install] [INFO] Installing C:devjavaworkspacejboss-s

eam-2.0.1.GAclassespomsparent.pom to C:Usersdavidgimelle.m2repositoryorg

jbossseamparent2.0.1.GAparent-2.0.1.GA.pom

[copy] Copying 1 file to C:devjavaworkspacejboss-seam-2.0

.1.GAclassespoms

[copy] Copying 1 file to C:devjavaworkspacejboss-seam-2.0

.1.GAclassespoms

[copy] Copying 1 file to C:devjavaworkspacejboss-seam-2.0

.1.GAclassespoms

[copy] Copying 1 file to C:devjavaworkspacejboss-seam-2.0

.1.GAclassespoms

[copy] Copying 1 file to C:devjavaworkspacejboss-seam-2.0

.1.GAclassespoms

[copy] Copying 1 file to C:devjavaworkspacejboss-seam-2.0

.1.GAclassespoms

[copy] Copying 1 file to C:devjavaworkspacejboss-seam-2.0

.1.GAclassespoms

[copy] Copying 1 file to C:devjavaworkspacejboss-seam-2.0

.1.GAclassespoms

[copy] Copying 1 file to C:devjavaworkspacejboss-seam-2.0

.1.GAclassespoms

[copy] Copying 1 file to C:devjavaworkspacejboss-seam-2.0

.1.GAclassespoms

 

copyseam:

 

copyseamdependencies:

 

copyjbossembedded:

 

copy-icefaces-home:

 

copy-icefaces-maven:

 

copy-lib:

[echo] Copying Seam and depdencies to the E:/DavidDate/DevNuts/ProjetsEclip

se/helloworld/lib directory...

[copy] Copying 97 files to C:devjavaworkspacehelloworldl

ib

[copy] Copied 4 empty directories to 1 empty directory under E:DavidDateD

evNutsProjetsEclipsehelloworldlib

[echo] Copying JBoss Embedded configuration to the E:/DavidDate/DevNuts/Pro

jetsEclipse/helloworld/bootstrap directory...

[copy] Copying 35 files to C:devjavaworkspacehelloworldb

ootstrap

[copy] Copied 15 empty directories to 2 empty directories under E:DavidDat

eDevNutsProjetsEclipsehelloworldbootstrap

 

file-copy-war:

 

file-copy-ear:

[echo] Copying resources needed for EAR deployment to the E:/DavidDate/DevN

uts/ProjetsEclipse/helloworld/resources directory...

[copy] Copying 1 file to C:devjavaworkspacehelloworldres

ourcesWEB-INF

[copy] Copying 1 file to C:devjavaworkspacehelloworld

[copy] Copying 6 files to C:devjavaworkspacehelloworldre

sources

 

setup-filters:

 

file-copy:

[copy] Copying 11 files to C:devjavaworkspacehelloworldr

esources

[copy] Copying 1 file to C:devjavaworkspacehelloworld

[copy] Copying 1 file to C:devjavaworkspacehelloworld

[copy] Copying 1 file to C:devjavaworkspacehelloworld

[copy] Copying 1 file to C:devjavaworkspacehelloworldres

ources

[copy] Copying 1 file to C:devjavaworkspacehelloworld.se

ttings

[copy] Copying 1 file to C:devjavaworkspacehelloworldres

ources

[copy] Copying 1 file to C:devjavaworkspacehelloworldres

ources

[copy] Copying 1 file to C:devjavaworkspacehelloworldres

ources

[copy] Copying 1 file to C:devjavaworkspacehelloworldres

ources

[copy] Copying 1 file to C:devjavaworkspacehelloworldres

ources

[copy] Copying 10 files to C:devjavaworkspacehelloworldv

iew

[copy] Copying 2 files to C:devjavaworkspacehelloworldvi

ew

[copy] Copying 1 file to C:devjavaworkspacehelloworldsrc

actioncomgetj2eetutoseamhelloworld

[copy] Copying 6 files to C:devjavaworkspacehelloworld

[mkdir] Created dir: C:devjavaworkspacehelloworldsrcmode

l

[mkdir] Created dir: C:devjavaworkspacehelloworldsrctest

 

[copy] Copying 1 file to C:devjavaworkspacehelloworldsrc

test

[mkdir] Created dir: C:devjavaworkspacehelloworldnbprojec

t

[copy] Copying 3 files to C:devjavaworkspacehelloworldnb

project

 

create-project:

[echo] A new Seam project named 'helloworld' was created in the E:/DavidDat

e/DevNuts/ProjetsEclipse directory

[echo] Type 'seam explode' and go to http://localhost:8080/helloworld

[echo] Eclipse Users: Add the project into Eclipse using File > New > Proje

ct and select General > Project (not Java Project)

[echo] NetBeans Users: Open the project in NetBeans

 

new-project:

 

BUILD SUCCESSFUL

Total time: 40 seconds

 

C:devjavaworkspacejboss-seam-2.0.1.GA>

 

 

3 - Importer le projet dans Eclipse

Ouvrir Eclipse

Dans le file choisir

            New/project/general/project

Next

Taper helloworld en nom de projet

Laisser la compilation automatique d’Eclipse se faire. Si vous n’avez de compilation automatique aller dans Project/buildAll

 

4 - Déployer dans JBoss

Ouvrer la vue Ant de Eclipse

Dans le projet sélectionner le fichier build.xml et le glisser dans la vue ant

            Dans la vue ant, ouvrir le nœud helloworld et double cliquer sur la target Deploy

(Vous allez peut-être avoir un message de votre firewall, il faut autoriser l’accès à JBoss)

 

5 - Lancer jboss

Aller dans la vue JBoss et lancer JBoss

(Vous allez peut-être avoir un message de votre firewall, il faut autoriser l’accès à JBoss et java)

 

6 - Voir la page par défaut

Aller votre navigateur préféré a l’adresse : http://localhost:8080/helloworld/ Vous devez y voir la page par défaut de l’application

La suite de ce tutorial est ici : Créer une première page web - Tutorial Seam partie 3

Références :
Tutorial seam Partie 1 : Installer SEAM et JBoss
Tutorial seam Partie 3 : Créer une première page web - Tutorial Seam partie 3
La doc de seam : 
http://www.seamframework.org/Documentation
Installer Ant :  http://java.developpez.com/articles/ant/partie2/

Partager cet article
Repost0

commentaires

Summary

  • : GetJ2ee -Java development
  • : Articles about Java and EE
  • Contact

Profil

  • David Gimelle
  • Java Developer for more 10 years. I worked in France, Canada and Switzerland. I am contractor in London since 2010.
  • Java Developer for more 10 years. I worked in France, Canada and Switzerland. I am contractor in London since 2010.

Contact

You can contact me here

or by Twitter

Search

Archives