首先到官方网站去下载jbpm-starters-kit-3.1包并解压到c:/jbpm-starters-kit-3.1文件夹中.接下来我们开始迁移JBPM.
1)切换到jbpm-db目录,将mssql的JDBC连接包文件放到mssql/lib/目录下,同时修改hibernate.properties中的数据库连接信息,(我用的是jtds)
hibernate.dialect=org.hibernate.dialect.SQLServerDialect
hibernate.connection.driver_class=net.sourceforge.jtds.jdbc.Driver
hibernate.connection.url=jdbc:jtds:sqlserver://localhost:1433/jbpmtest
hibernate.connection.username=sa
hibernate.connection.password=test
hibernate.show_sql=true
hibernate.c3p0.min_size=1
hibernate.c3p0.max_size=3
hibernate.query.substitutions=true 1, false 0
在 /jbpm-db 目录,执行如下命令:
ant mssql.scripts
执行成功后,在 /jbpm-db/build/mssql/scripts 目录里生成了四个 sql 脚本使用create.db.sql可以创建JBPM所需的数据表
(2)切换到JBPM目录,修改根目录下的build.properties文件,只需要确保ANT和JBPM.HOME的目录设置正确即可.如下
# ant.home is only used in the ant.install.libs target for copying the junit and clover libs
ant.home=D:/apache-ant-1.5.4
# jbpm.home is only to allow build scripts to open the browser with the html test results
jbpm.home=D:/jbpm-starters-kit-3.1.2/jbpm.3
(这里我将jbpm目录复制一份为jbpm.3,这和用eclipse开发jbpm有关系)
然后 对src/config.files/hibernate.cfg.xml文件中的数据库信息进行修改,同时更改 src/resources/hsqldb文件夹更名为mssql并修改其下的create.db.hinbernate.properties文件 中数据库信息。
(3)将SQLserver的JDBC连接包COPY一份到jbpm/lib/mssql/目录下(没有mssql这个目录可以建一个)
(4)修改jbpm目录下的build.deploy.xml文件,只需要修改target name为build.webapp的部分如下
<target name="build.webapp" description="builds jbpm.war">
<ant antfile="build.xml" target="build" />
<mkdir dir="build/jbpm.war.dir" />
<copy todir="build/jbpm.war.dir">
<fileset dir="src/resources/jbpm.war" />
</copy>
<copy todir="build/jbpm.war.dir/WEB-INF/lib">
<fileset dir="build" includes="jbpm*.jar,converter.jar" excludes="*src*.jar" />
<fileset dir="lib/jsf" includes="*.jar" />
<fileset dir="lib/dom4j" includes="*.jar" />
<fileset dir="lib/hibernate" includes="*.jar" />
<fileset dir="lib/mssql" includes="*.jar" />
<fileset dir="lib/commons" includes="commons-digester-*.jar, commons-beanutils-*.jar, commons-fileupload-*.jar" />
<fileset dir="lib/jboss" includes="*.jar" excludes="jboss*.jar,*servlet*.jar,*hsql*.jar,dom4j*.jar" />
</copy>
<jar destfile="build/jbpm.war">
<fileset dir="build/jbpm.war.dir" />
</jar>
</target>
(5)修改jbpm目录下的build.deploy.xml文件,只需要修改target name为create.db的部分如下
<target name="create.db" depends="declare.jbpm.tasks, db.clean, db.start" description="creates a hypersonic database with the jbpm tables and loads the processes in there">
<jbpmschema actions="create"
cfg="${basedir}/src/config.files/hibernate.cfg.xml"
properties="${basedir}/src/resources/mssql/create.db.hibernate.properties"/>
<loadidentities file="${basedir}/src/resources/mssql/identity.db.xml"
cfg="${basedir}/src/config.files/hibernate.cfg.xml"
properties="${basedir}/src/resources/mssql/create.db.hibernate.properties"/>
<ant antfile="build.xml" target="build.processes" inheritall="false" />
<deployprocess cfg="${basedir}/src/config.files/hibernate.cfg.xml"
properties="${basedir}/src/resources/mssql/create.db.hibernate.properties">
<fileset dir="build" includes="*.process" />
</deployprocess>
<antcall target="db.stop" />
</target>
(6)执行/jbpm目录下的build.xml,将在/jbpm/build目录下打包可JBPM.WAR直接拷贝到TOMCAT的webapps目录下即可.
需要注意的几点:
1.我使用的是tomcat5.5.20据有高手实践tomcat5.5以下是不成的会报org.apache.commons.el的错误.
2.在执行上面第6步的时候ant build的会报一些错误这个和hsqldb有关需要再改一些build.deploy.xml文件里关于hsqldb的部分,不过对打包war迁移JBPM没什么大影响.
3.我完成以上工作是在eclipse里导入了jbpm项目后完成.如果你没在eclipse操作.需要注意ant,和jbpm的相关路径的设置