采用seam2的工具创建seam工程
最近想玩玩seam,看到seam3都出来了,不过我还是下载了个jboss-seam-2.2.2.Final,比较2。后来用这个下载的目录中有个seam.bat,运行,结合各种命令就可以进行工程的创建修改等各种操作,从这方面看,seam简直就是一个开发工具。
我用seam工具程序创建一个工程,并发布,记录下来整个过程如下:
?
D:\tool\jboss-seam-2.2.2.Final>seam setup
SEAM_HOME: D:\tool\jboss-seam-2.2.2.Final
Using seam-gen sources from: D:\tool\jboss-seam-2.2.2.Final\seam-gen
Buildfile: D:\tool\jboss-seam-2.2.2.Final\seam-gen\build.xml
init:
setup:
???? [echo] Welcome to seam-gen 2.2.2.Final :-)
???? [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) [C:/Projects] [C:/Projects]
D:/MySeam
??? [input] Enter your JBoss AS home directory [C:/Program Files/jboss-5.1.0.GA]
?[C:/Program Files/jboss-5.1.0.GA]
D:\servers\JBoss510
??? [input] Enter your JBoss AS domain [default] [default]
default
??? [input] Enter your GlassFish V2 or V3 home directory (Ignore if you aren't d
eploying to GlassFish) [C:/Program Files/glassfish-v2.1] [C:/Program Files/glass
fish-v2.1]
??? [input] Enter your GlassFish domain (Ignore if you aren't deploying to Glass
Fish) [domain1] [domain1]
??? [input] Enter the project name [myproject] [myproject]
mySeam1
???? [echo] Accepted project name as: mySeam1
??? [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 [glassX] (blueSky, classic, darkX, deepMarin
e, DEFAULT, emeraldTown, [glassX], japanCherry, laguna, ruby, wine)
blueSky
??? [input] Is this project deployed as an EAR (with EJB components) or a WAR (w
ith no EJB support)? [war] (ear, [war])
ear
??? [input] Enter the base package name for your Java classes [com.mydomain.mySe
am1] [com.mydomain.mySeam1]
leon.seam.domain1
??? [input] Enter the Java package name for your session beans [leon.seam.domain
1.action] [leon.seam.domain1.action]
leon.seam.domain1.action
??? [input] Enter the Java package name for your entity beans [leon.seam.domain1
.model] [leon.seam.domain1.model]
leon.seam.domain1.model
??? [input] Enter the Java package name for your test cases [leon.seam.domain1.t
est] [leon.seam.domain1.test]
leon.seam.domain1.test
??? [input] What kind of database are you using? [hsql] ([hsql], mysql, derby, o
racle, postgres, mssql, db2, sybase, enterprisedb, h2)
mysql
??? [input] Enter the filesystem path to the JDBC driver jar [] []
D:\jars\mysql-connector-java-5.0.5.jar
??? [input] skipping input as property driver.license.jar.new has already been s
et.
??? [input] Enter the Hibernate dialect for your database [org.hibernate.dialect
.MySQLDialect] [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]
com.mysql.jdbc.Driver
??? [input] Enter the JDBC DataSource class for your database [com.mysql.jdbc.jd
bc2.optional.MysqlDataSource] [com.mysql.jdbc.jdbc2.optional.MysqlDataSource]
com.mysql.jdbc.jdbc2.optional.MysqlDataSource
??? [input] Enter the JDBC URL for your database [jdbc:mysql:///test] [jdbc:mysq
l:///test]
jdbc:mysql://localhost:3306/mydb1
??? [input] Enter the database username [sa] [sa]
root
??? [input] Enter the database password [] []
leonsu
??? [input] skipping input as property hibernate.default_schema.entered has alre
ady 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 e
ach time you deploy? [n] (y, [n])
n
[propertyfile] Creating new property file: D:\tool\jboss-seam-2.2.2.Final\seam-g
en\build.properties
???? [echo] Installing JDBC driver jar to JBoss AS
???? [copy] Copying 1 file to D:\servers\JBoss510\server\default\lib
init:
init-properties:
???? [echo] D:/servers/JBoss510
validate-workspace:
validate-project:
settings:
???? [echo] JBoss AS home: D:/servers/JBoss510
???? [echo] GlassFish home: C:/Program Files/glassfish-v2.1
???? [echo] Project name: mySeam1
???? [echo] Project location: D:/MySeam/mySeam1
???? [echo] Project type: ear
???? [echo] IceFaces: n
???? [echo] Action package: leon.seam.domain1.action
???? [echo] Model package: leon.seam.domain1.model
???? [echo] Test package: leon.seam.domain1.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://localhost:3306/mydb1
???? [echo] Database username: root
???? [echo] Database password: leonsu
???? [echo]
???? [echo] Type 'seam create-project' to create the new project
BUILD SUCCESSFUL
Total time: 13 minutes 53 seconds
D:\tool\jboss-seam-2.2.2.Final>seam create-project
?...
?...
?...
???? [copy] Copying 1 file to D:\tool\jboss-seam-2.2.2.Final\classes\poms
???? [copy] Copying 1 file to D:\tool\jboss-seam-2.2.2.Final\classes\poms
???? [copy] Copying 1 file to D:\tool\jboss-seam-2.2.2.Final\classes\poms
???? [copy] Copying 1 file to D:\tool\jboss-seam-2.2.2.Final\classes\poms
???? [copy] Copying 1 file to D:\tool\jboss-seam-2.2.2.Final\classes\poms
???? [copy] Copying 1 file to D:\tool\jboss-seam-2.2.2.Final\classes\poms
???? [copy] Copying 1 file to D:\tool\jboss-seam-2.2.2.Final\classes\poms
???? [copy] Copying 1 file to D:\tool\jboss-seam-2.2.2.Final\classes\poms
???? [copy] Copying 1 file to D:\tool\jboss-seam-2.2.2.Final\classes\poms
???? [copy] Copying 1 file to D:\tool\jboss-seam-2.2.2.Final\classes\poms
???? [copy] Copying 1 file to D:\tool\jboss-seam-2.2.2.Final\classes\poms
???? [copy] Copying 1 file to D:\tool\jboss-seam-2.2.2.Final\classes\poms
???? [copy] Copying 1 file to D:\tool\jboss-seam-2.2.2.Final\classes\poms
???? [copy] Copying 1 file to D:\tool\jboss-seam-2.2.2.Final\classes\poms
copyseam:
copyseamdependencies:
copyjbossembedded:
copy-icefaces-home:
copy-icefaces-maven:
copy-lib:
???? [echo] Copying Seam and dependencies to the D:/MySeam/mySeam1/lib directory
...
???? [copy] Copying 152 files to D:\MySeam\mySeam1\lib
???? [copy] Copied 5 empty directories to 2 empty directories under D:\MySeam\my
Seam1\lib
???? [echo] Copying JBoss Embedded configuration to the D:/MySeam/mySeam1/bootst
rap directory...
???? [copy] Copying 30 files to D:\MySeam\mySeam1\bootstrap
file-copy-war:
file-copy-ear:
???? [echo] Copying build scripts for EAR deployment to the D:/MySeam/mySeam1 di
rectory...
???? [copy] Copying 2 files to D:\MySeam\mySeam1
???? [copy] Copying 1 file to D:\MySeam\mySeam1
???? [copy] Copying 1 file to D:\MySeam\mySeam1
???? [copy] Copying 1 file to D:\MySeam\mySeam1
???? [echo] Copying resources needed for EAR deployment to the D:/MySeam/mySeam1
/resources directory...
???? [copy] Copying 8 files to D:\MySeam\mySeam1\resources
setup-filters:
file-copy:
???? [copy] Copying 1 file to D:\MySeam\mySeam1
???? [copy] Copying 3 files to D:\MySeam\mySeam1\resources
???? [copy] Copying 11 files to D:\MySeam\mySeam1\resources
???? [copy] Copying 4 files to D:\MySeam\mySeam1
???? [copy] Copying 1 file to D:\MySeam\mySeam1
???? [copy] Copying 1 file to D:\MySeam\mySeam1
???? [copy] Copying 1 file to D:\MySeam\mySeam1
???? [copy] Copying 1 file to D:\MySeam\mySeam1
???? [copy] Copying 1 file to D:\MySeam\mySeam1\.settings
???? [copy] Copying 1 file to D:\MySeam\mySeam1
???? [copy] Copying 1 file to D:\MySeam\mySeam1
??? [mkdir] Created dir: D:\MySeam\mySeam1\nbproject
???? [copy] Copying 3 files to D:\MySeam\mySeam1\nbproject
???? [copy] Copying 1 file to D:\MySeam\mySeam1\resources
???? [copy] Copying 1 file to D:\MySeam\mySeam1\resources
???? [copy] Copying 1 file to D:\MySeam\mySeam1\resources
???? [copy] Copying 1 file to D:\MySeam\mySeam1\resources
???? [copy] Copying 1 file to D:\MySeam\mySeam1\resources
???? [copy] Copying 1 file to D:\MySeam\mySeam1\resources
???? [copy] Copying 1 file to D:\MySeam\mySeam1\resources
???? [copy] Copying 1 file to D:\MySeam\mySeam1\resources
???? [copy] Copying 13 files to D:\MySeam\mySeam1\view
???? [copy] Copying 16 files to D:\MySeam\mySeam1\view
???? [copy] Copying 1 file to D:\MySeam\mySeam1\src\hot\leon\seam\domain1\action
???? [copy] Copying 1 file to D:\MySeam\mySeam1\src\hot\leon\seam\domain1\action
???? [copy] Copying 3 files to D:\MySeam\mySeam1
???? [copy] Copying 1 file to D:\MySeam\mySeam1
??? [mkdir] Created dir: D:\MySeam\mySeam1\src\main\leon\seam\domain1\model
??? [mkdir] Created dir: D:\MySeam\mySeam1\src\test\leon\seam\domain1\test
???? [copy] Copying 1 file to D:\MySeam\mySeam1\src\test
create-project:
???? [echo] A new Seam project named 'mySeam1' was created in the D:/MySeam dire
ctory
???? [echo] Type 'seam explode' and go to http://localhost:8080/mySeam1
???? [echo] Eclipse Users: Import the project using File > Import... > Existing
Projects into Workspace, set the root directory to D:/MySeam, then select the pr
oject named mySeam1
???? [echo] NetBeans Users: Open the project using File > Open project... and se
lect the project folder D:/MySeam/mySeam1
???? [echo] IDEA Users: Open the project using File > Open project... and select
?the file D:/MySeam/mySeam1/mySeam1.ipr
BUILD SUCCESSFUL
Total time: 21 seconds
D:\tool\jboss-seam-2.2.2.Final>seam explode
SEAM_HOME: D:\tool\jboss-seam-2.2.2.Final
Using seam-gen sources from: D:\tool\jboss-seam-2.2.2.Final\seam-gen
Buildfile: D:\tool\jboss-seam-2.2.2.Final\seam-gen\build.xml
init:
init-properties:
???? [echo] D:/servers/JBoss510
validate-workspace:
validate-project:
explode:
???? [echo] Deploying project 'mySeam1' to JBoss AS as an exploded directory
init:
??? [mkdir] Created dir: D:\MySeam\mySeam1\exploded-archives\mySeam1.ear\mySeam1
_jar
??? [mkdir] Created dir: D:\MySeam\mySeam1\exploded-archives\mySeam1.ear\mySeam1
_war
??? [mkdir] Created dir: D:\MySeam\mySeam1\dist
groovy.compile:
groovy.copy:
compile:
??? [javac] Compiling 2 source files to D:\MySeam\mySeam1\exploded-archives\mySe
am1.ear\mySeam1_jar
copyclasses:
jar:
???? [copy] Copying 2 files to D:\MySeam\mySeam1\exploded-archives\mySeam1.ear\m
ySeam1_jar
???? [copy] Copying 2 files to D:\MySeam\mySeam1\exploded-archives\mySeam1.ear\m
ySeam1_jar\META-INF
???? [copy] Copying 1 file to D:\MySeam\mySeam1\exploded-archives\mySeam1.ear\my
Seam1_jar\META-INF
???? [copy] Copying 1 file to D:\MySeam\mySeam1\exploded-archives\mySeam1.ear\my
Seam1_jar
war:
???? [copy] Copying 29 files to D:\MySeam\mySeam1\exploded-archives\mySeam1.ear\
mySeam1_war
???? [copy] Copying 1 file to D:\MySeam\mySeam1\exploded-archives\mySeam1.ear\my
Seam1_war\WEB-INF\classes
???? [copy] Copying 3 files to D:\MySeam\mySeam1\exploded-archives\mySeam1.ear\m
ySeam1_war\WEB-INF
???? [copy] Copying 14 files to D:\MySeam\mySeam1\exploded-archives\mySeam1.ear\
mySeam1_war\WEB-INF\lib
???? [copy] Copying 7 files to D:\MySeam\mySeam1\exploded-archives\mySeam1.ear\m
ySeam1_war\WEB-INF\classes
???? [copy] Copying 1 file to D:\MySeam\mySeam1\exploded-archives\mySeam1.ear\my
Seam1_war\WEB-INF
ear:
???? [copy] Copying 1 file to D:\MySeam\mySeam1\exploded-archives\mySeam1.ear
???? [copy] Copying 15 files to D:\MySeam\mySeam1\exploded-archives\mySeam1.ear\
lib
???? [copy] Copying 2 files to D:\MySeam\mySeam1\exploded-archives\mySeam1.ear\M
ETA-INF
stage:
datasource:
???? [copy] Copying 1 file to D:\servers\JBoss510\server\default\deploy
explode:
???? [copy] Copying 18 files to D:\servers\JBoss510\server\default\deploy\mySeam
1.ear
???? [copy] Copying 8 files to D:\servers\JBoss510\server\default\deploy\mySeam1
.ear\mySeam1.jar
???? [copy] Copying 55 files to D:\servers\JBoss510\server\default\deploy\mySeam
1.ear\mySeam1.war
BUILD SUCCESSFUL
Total time: 5 seconds
D:\tool\jboss-seam-2.2.2.Final>
?运用到seam的三个命令:setup, project-generate, explode
setup阶段,[input]会提示输入各种参数,一步步填给它就好了
填完了以后,project-generate命令生成工程,explode命令发布到JBoss
运行JBoss,访问,发现很多生成的。
按照它的指示,我将工程导入到Eclipse,哇,发现生成的东西太多了。所有需要的包都给你导入了。整合了EJB3,JSF,Hibernate,配置JBosss Drools规则引擎等等。挺强大的。前台的页面也生成的不错,简洁好看。
剩下的工作就是根据你自己的需要修改项目咯。
开发环境的搭建都不需要了。变态……