Buildfile: build.xml
init:
setup:
[echo] Welcome to seam-gen 2.2.2.EAP5 :-)
[echo] Answer each question or hit ENTER to accept the default (in brackets)
[echo]
[input] Enter the directory where you want the project to be created (should not contain spaces) [/home/mnovotny/projects] [/home/mnovotny/projects]
[input] Enter your JBoss AS home directory [/var/lib/jbossas] [/var/lib/jbossas]
/home/mnovotny/apps/jboss-eap-5.1/jboss-as
[input] Enter your JBoss AS domain [default] [default]
[input] Enter the project name [myproject] [myproject]
helloworld
[echo] Accepted project name as: helloworld
[input] Select a RichFaces skin [glassX] (blueSky, classic, darkX, deepMarine, DEFAULT, emeraldTown, [glassX], japanCherry, laguna, ruby, wine)
[input] Is this project deployed as an EAR (with EJB components) or a WAR (with no EJB support)? [war] (ear, [war])
ear
[input] Enter the base package name for your Java classes [com.mydomain.helloworld] [com.mydomain.helloworld]
[input] Enter the Java package name for your session beans [com.mydomain.helloworld.action] [com.mydomain.helloworld.action]
[input] Enter the Java package name for your entity beans [com.mydomain.helloworld.model] [com.mydomain.helloworld.model]
[input] Enter the Java package name for your test cases [com.mydomain.helloworld.test] [com.mydomain.helloworld.test]
[input] What kind of database are you using? [hsql] ([hsql], mysql, derby, oracle, postgres, mssql, db2, sybase, enterprisedb, h2)
mysql
[input] Enter the filesystem path to the JDBC driver jar [] []
/usr/share/java/mysql.jar
[input] skipping input as property driver.license.jar.new has already been set.
[input] Enter the Hibernate dialect for your database [org.hibernate.dialect.MySQLDialect] [org.hibernate.dialect.MySQLDialect]
[input] Enter the JDBC driver class for your database [com.mysql.jdbc.Driver] [com.mysql.jdbc.Driver]
[input] Enter the JDBC DataSource class for your database [com.mysql.jdbc.jdbc2.optional.MysqlDataSource] [com.mysql.jdbc.jdbc2.optional.MysqlDataSource]
[input] Enter the JDBC URL for your database [jdbc:mysql:///test] [jdbc:mysql:///test]
[input] Enter the database username [sa] [sa]
root
[input] Enter the database password [] []
[input] skipping input as property hibernate.default_schema.entered has already been set.
[input] Enter the database catalog name (Enter '-' to clear previous value) [] []
[input] Are you working with tables that already exist in the database? [n] (y, [n])
y
[input] Do you want to recreate the database tables and execute import.sql each time you deploy? [n] (y, [n])
[propertyfile] Creating new property file: /home/mnovotny/apps/jboss-eap-5.1/seam/seam-gen/build.properties
[echo] Installing JDBC driver jar to JBoss AS
[copy] Copying 1 file to /home/mnovotny/apps/jboss-eap-5.1/jboss-as/server/default/lib
init:
init-properties:
[echo] /home/mnovotny/apps/jboss-eap-5.1/jboss-as
validate-workspace:
validate-project:
settings:
[echo] JBoss AS home: /home/mnovotny/apps/jboss-eap-5.1/jboss-as
[echo] Project name: helloworld
[echo] Project location: /home/mnovotny/projects/helloworld
[echo] Project type: ear
[echo] Action package: com.mydomain.helloworld.action
[echo] Model package: com.mydomain.helloworld.model
[echo] Test package: com.mydomain.helloworld.test
[echo] JDBC driver class: com.mysql.jdbc.Driver
[echo] JDBC DataSource class: com.mysql.jdbc.jdbc2.optional.MysqlDataSource
[echo] Hibernate dialect: org.hibernate.dialect.MySQLDialect
[echo] JDBC URL: jdbc:mysql:///test
[echo] Database username: root
[echo] Database password:
[echo]
[echo] Type './seam create-project' to create the new project
Buildfile: build.xml
init:
setup:
[echo] Welcome to seam-gen 2.2.2.EAP5 :-)
[echo] Answer each question or hit ENTER to accept the default (in brackets)
[echo]
[input] Enter the directory where you want the project to be created (should not contain spaces) [/home/mnovotny/projects] [/home/mnovotny/projects]
[input] Enter your JBoss AS home directory [/var/lib/jbossas] [/var/lib/jbossas]
/home/mnovotny/apps/jboss-eap-5.1/jboss-as
[input] Enter your JBoss AS domain [default] [default]
[input] Enter the project name [myproject] [myproject]
helloworld
[echo] Accepted project name as: helloworld
[input] Select a RichFaces skin [glassX] (blueSky, classic, darkX, deepMarine, DEFAULT, emeraldTown, [glassX], japanCherry, laguna, ruby, wine)
[input] Is this project deployed as an EAR (with EJB components) or a WAR (with no EJB support)? [war] (ear, [war])
ear
[input] Enter the base package name for your Java classes [com.mydomain.helloworld] [com.mydomain.helloworld]
[input] Enter the Java package name for your session beans [com.mydomain.helloworld.action] [com.mydomain.helloworld.action]
[input] Enter the Java package name for your entity beans [com.mydomain.helloworld.model] [com.mydomain.helloworld.model]
[input] Enter the Java package name for your test cases [com.mydomain.helloworld.test] [com.mydomain.helloworld.test]
[input] What kind of database are you using? [hsql] ([hsql], mysql, derby, oracle, postgres, mssql, db2, sybase, enterprisedb, h2)
mysql
[input] Enter the filesystem path to the JDBC driver jar [] []
/usr/share/java/mysql.jar
[input] skipping input as property driver.license.jar.new has already been set.
[input] Enter the Hibernate dialect for your database [org.hibernate.dialect.MySQLDialect] [org.hibernate.dialect.MySQLDialect]
[input] Enter the JDBC driver class for your database [com.mysql.jdbc.Driver] [com.mysql.jdbc.Driver]
[input] Enter the JDBC DataSource class for your database [com.mysql.jdbc.jdbc2.optional.MysqlDataSource] [com.mysql.jdbc.jdbc2.optional.MysqlDataSource]
[input] Enter the JDBC URL for your database [jdbc:mysql:///test] [jdbc:mysql:///test]
[input] Enter the database username [sa] [sa]
root
[input] Enter the database password [] []
[input] skipping input as property hibernate.default_schema.entered has already been set.
[input] Enter the database catalog name (Enter '-' to clear previous value) [] []
[input] Are you working with tables that already exist in the database? [n] (y, [n])
y
[input] Do you want to recreate the database tables and execute import.sql each time you deploy? [n] (y, [n])
[propertyfile] Creating new property file: /home/mnovotny/apps/jboss-eap-5.1/seam/seam-gen/build.properties
[echo] Installing JDBC driver jar to JBoss AS
[copy] Copying 1 file to /home/mnovotny/apps/jboss-eap-5.1/jboss-as/server/default/lib
init:
init-properties:
[echo] /home/mnovotny/apps/jboss-eap-5.1/jboss-as
validate-workspace:
validate-project:
settings:
[echo] JBoss AS home: /home/mnovotny/apps/jboss-eap-5.1/jboss-as
[echo] Project name: helloworld
[echo] Project location: /home/mnovotny/projects/helloworld
[echo] Project type: ear
[echo] Action package: com.mydomain.helloworld.action
[echo] Model package: com.mydomain.helloworld.model
[echo] Test package: com.mydomain.helloworld.test
[echo] JDBC driver class: com.mysql.jdbc.Driver
[echo] JDBC DataSource class: com.mysql.jdbc.jdbc2.optional.MysqlDataSource
[echo] Hibernate dialect: org.hibernate.dialect.MySQLDialect
[echo] JDBC URL: jdbc:mysql:///test
[echo] Database username: root
[echo] Database password:
[echo]
[echo] Type './seam create-project' to create the new project
Copy to ClipboardCopied!Toggle word wrapToggle overflow
ツールが適当なデフォルト値を選択します。選択されたデフォルト値で問題なければ、そのまま Enter を押します。
ここでの最も重要な選択は、プロジェクトのデプロイを EAR または WAR アーカイブとして行うかどうかということです。EAR プロジェクトは Enterprise JavaBeans 3.0 (EJB3) に対応しており、Java EE 5 が必要です。WAR プロジェクトは EJB3 に対応していませんが、J2EE 環境にデプロイ可能です。WAR は EAR に比べシンプルなパッケージです。JBoss のような EJB3 に対応済みのアプリケーションサーバーがインストールされている場合は ear を選択してください。これ以外は war を選択してください。以降、このチュートリアルでは EAR デプロイメントを使用していると仮定しますが、プロジェクトが WAR デプロイメントの場合もこのステップに沿って進めることができます。
Buildfile: build.xml
...
new-project:
[echo] A new Seam project named 'helloworld' was created in the C:\Projects directory
[echo] Type 'seam explode' and go to http://localhost:8080/helloworld
[echo] Eclipse Users: Add the project into Eclipse using File > New > Project and select General > Project (not Java Project)
[echo] NetBeans Users: Open the project in NetBeans
BUILD SUCCESSFUL Total time: 7 seconds
C:\Projects\jboss-seam>
Buildfile: build.xml
...
new-project:
[echo] A new Seam project named 'helloworld' was created in the C:\Projects directory
[echo] Type 'seam explode' and go to http://localhost:8080/helloworld
[echo] Eclipse Users: Add the project into Eclipse using File > New > Project and select General > Project (not Java Project)
[echo] NetBeans Users: Open the project in NetBeans
BUILD SUCCESSFUL Total time: 7 seconds
C:\Projects\jboss-seam>
Copy to ClipboardCopied!Toggle word wrapToggle overflow
これにより Seam の JAR 郡、依存する JAR 郡、 JDBC ドライバの JAR 郡を新しい Eclipse プロジェクトにコピーします。 必要となるすべてのリソースや設定ファイル、 Facelets テンプレートファイルとスタイルシートの他、 Eclipse メタデータと Ant ビルドスクリプトを生成します。 プロジェクトを追加すると直ちに Eclipse プロジェクトは JBoss 内の展開されたディレクトリ構造に自動的にデプロイされます。 プロジェクトを追加するには、 NewProject...GeneralProjectNext の順で進み、 Project name (この場合は helloworld) を入力し Finish をクリックします。New Project のウィザードで Java Project は選択しないようにしてください。