seam-genの利用方法

JBossSeamでseam-genを利用して任意のプロジェクトを作成することができます。ここではseam-2.1.1.GAを利用しており、バージョンによって若干の違いがありますが、ほぼ同じです。
JBossAS、JBossSeamがそれぞれCドライブ直下にインストールされていることを想定して以下説明を行います。(このコマンドを実行する前にAntを必ずインストールしてください)

C:\jboss-seam-2.1.1.GA>seam setup

[input] Enter your Java project workspace (the directory that contains your
Seam projects) [C:/Projects] [C:/Projects]
 ⇒デフォルトを選択する。

[input] Enter your JBoss AS home directory [C:/Program Files/jboss-4.2.3.GA]
[C:/Program Files/jboss-4.2.3.GA]
C:/jboss-5.0.0.GA
 ⇒「C:/jboss-5.0.0.GA」と入力しEnter

[input] Enter the project name [myproject] [myproject]
helloseam
 ⇒プロジェクト名を入力。(ここでは「helloseam」)

[input] Do you want to use ICEfaces instead of RichFaces [n] (y, [n])
 ⇒デフォルトを選択する。(RichFaces)

[input] skipping input as property icefaces.home.new has already been set.
[input] Select a RichFaces skin [classic] (blueSky, [classic], deepMarine, D
EFAULT, emeraldTown, japanCherry, ruby, wine)
 ⇒デフォルトを選択する。(classic)

[input] Is this project deployed as an EAR (with EJB components) or a WAR (w
ith no EJB support) [ear] ([ear], war)
 ⇒デフォルトを選択する。(ear)

[input] Enter the Java package name for your session beans [com.mydomain.hel
loseam] [com.mydomain.helloseam]
 ⇒Session Beanのパッケージ指定。

[input] Enter the Java package name for your entity beans [org.sample.hello.
seam.session] [org.sample.hello.seam.session]
 ⇒Entity Beanのパッケージ指定。

[input] Enter the Java package name for your test cases [org.sample.hello.se
am.session.test] [org.sample.hello.seam.session.test]
 ⇒Testクラスのパッケージ指定。

[input] What kind of database are you using? [hsql] ([hsql], mysql, oracle,
postgres, mssql, db2, sybase, enterprisedb, h2)
postgres
 ⇒利用DBの指定。(ここでは「postgres」を指定。)

[input] Enter the Hibernate dialect for your database [org.hibernate.dialect
.PostgreSQLDialect] [org.hibernate.dialect.PostgreSQLDialect]
 ⇒Dialectの指定。(デフォルトを指定)

[input] Enter the filesystem path to the JDBC driver jar [C:\jboss-seam-2.1.
1.GA/lib/hsqldb.jar] [C:\jboss-seam-2.1.1.GA/lib/hsqldb.jar]
C:/jboss-5.0.0.GA/server/default/lib/postgresql-8.X-XXX.jar
 ⇒JDBCドライバの場所を指定。

[input] Enter JDBC driver class for your database [org.postgresql.Driver] [o
rg.postgresql.Driver]
 ⇒JDBCドライバクラスの指定。(デフォルトを指定)

[input] Enter the JDBC URL for your database [jdbc:postgresql:template1] [jd
bc:postgresql:template1]
jdbc:postgresql://localhost:XXXX/testdb
 ⇒JDBCのURLを指定。(任意)

[input] Enter database username [sa] [sa] username
 ⇒DBのユーザ名を設定する。

[input] Enter database password password
 ⇒DBのパスワードを設定する。

[input] Enter the database schema name (it is OK to leave this blank)
 ⇒schema名(デフォルトのままでOK

[input] Enter the database catalog name (it is OK to leave this blank)
 ⇒Catalog名(デフォルトのままでOK

[input] Are you working with tables that already exist in the database? [n]
(y, [n])
 ⇒既存のDBを利用するか否かの質問。(とりあえずデフォルトでOK)


[input] Do you want to drop and recreate the database tables and data in imp
ort.sql each time you deploy? [n] (y, [n]) y
 ⇒デプロイごとにテーブルを再作成。(サンプルなのでとりあえずy)

この後「BUILD SUCCESSFUL」と出力されれば完了です。

C:\jboss-seam-2.1.1.GA>seam create-project

上記コマンドを実行すると、最初に行った設定内容を反映したプロジェクトがC:\Projects以下に作成されます。

後はEclipseのインポート機能を利用して取り込めばEclipseで開発を行えます。

簡単ですね!!

ちなみに、一度「seam setup」コマンドを実行すると、seam-genフォルダ(この例では「C:\jboss-seam-2.1.1.GA\seam-gen」)配下にbuild.propertiesというファイルが作成されます。このファイルは今回設定したプロジェクトの設定情報がすべて記載されており、次回以降seam setupコマンドを実行すると、このファイルから設定情報を読み取ってプロジェクトの作成を行ってしまいます。別のプロジェクトを作成するためにseam setupコマンドを実行する際は、このファイルを削除するか、ファイルを修正してから実行する必要があります。