如何搭建Dcm4chee的开发环境-2012
自2009年写的<<如何搭建Dcm4chee的开发环境>>之后得到一些朋友的关注,也反映了一些错误,其原因在于文档写的不够细,
可能导致大家理解上的错误。现在抽出时间重写一篇。
笔者的运行环境:
- Winxpsp3
- Java: JRE1.6.0_07 http://www.java.com/en/download/manual.jsp
- mysql v5.5.23 http://dev.mysql.com/downloads/installer/
- EclipseIDE for Java EE Developers http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/galileo/SR1/eclipse-jee-galileo-SR1-win32.zip
所需软件:
- jboss-4.2.3.GA http://transact.dl.sourceforge.net/project/jboss/JBoss/JBoss-4.2.3.GA/jboss-4.2.3.GA.zip
- Maven2.0.9 http://archive.apache.org/dist/maven/binaries/apache-maven-2.0.9-bin.zip
- XDoclet v1.2.3 http://transact.dl.sourceforge.net/project/xdoclet/xdoclet/1.2.3/xdoclet-bin-1.2.3.zip
- apache-FOP0.20.5 http://archive.apache.org/dist/xmlgraphics/fop/binaries/fop-0.20.5-bin.zip
- cactus-1.8.0 http://archive.apache.org/dist/jakarta/cactus/binaries/cactus-1.8.0-bin.zip
dcm4chee源代码及依赖库
- dcm4chee 2.14.7的源代码: http://transact.dl.sourceforge.net/project/dcm4che/dcm4chee/2.14.7/dcm4chee-2.14.7-src.zip
- dcm4che 1.4.26 http://transact.dl.sourceforge.net/project/dcm4che/dcm4che14/1.4.26/dcm4che-1.4.26.zip (注:dcm4che是DICOM库,dcm4chee引用了该库)
- dcm4chee-xds-1.0.0
安装运行环境:
1. 安装JRE 、Eclipse 、 MySql
2. 新建目录 dcm4chee作为我们搭建开发环境的目录(你也可以自己设定)
安装dcm4chee所依赖的库和工具
1.将下载的库和工具文件解压到dcm4chee目录
- xdoclet-1.2.3.zip
- cactus-1.8.0-bin.zip
- jboss-4.2.3.GA.zip
- fop-0.20.5.zip
- apache-maven-2.0.9.zip
- dcm4che-1.4.26.zip
- dcm4chee-xds-1.0.0
编译dcm4chee源码
- 解压dcm4chee-2.14.7-src.zip到dcm4chee目录
- 复制dcm4chee\dcm4chee-2.14.7-src\build.properties.default 文件为 build.properties
- 修改build.properties文件
#javac options javac.debug=on javac.deprecation=off javac.optimize=on javac.source=1.5 javac.target=1.5 #Override with your dcm4che-1.4.x dist location dcm4che14.home=F:/dcm4chee/dcm4che-1.4.26 #Override with your XDoclet dist location xdoclet.home=F:/dcm4chee/xdoclet-1.2.3 #Override with your Cactus dist location cactus.home=F:/dcm4chee/cactus-1.8.0-bin #Override with your local Maven2 repository m2.repos=F:/dcm4chee/.m2/repository #Override with your JBoss dist location jboss.home=F:/dcm4chee/jboss-4.2.3.GA #Override with your FOP dist location fop.home=F:/dcm4chee/fop-0.20.5 #Override with the version of dcm4chee-docstore to use. docstore-version=1.0.0 #Override with the version of dcm4chee-infoset to use. infoset-version=1.0.0
4.导入dcm4chee项目源代码。
打开eclipse, File->import, Existing Projects into Workspace , Finish
5. 修改相关build.xml文件解决对函数库依赖问题 (这里可能是比较容易出错的地方,确保dcm4chee-xds-1.0.0.zip文件已解压到该目录)
修改dcm4chee\dcm4chee-2.14.7-src\dcm4jboss-rid\build.xml文件
<property name="dcm4chee-docstore.lib"
value="F:/dcm4chee/dcm4chee-xds-1.0.0/standalone/lib"/>
修改dcm4chee\dcm4chee-2.14.7-src\dcm4jboss-web\build.xml
<property name="dcm4chee-xds-infoset-v30.lib"
value="F:/dcm4chee/dcm4chee-xds-1.0.0/server/default/lib"/>
修改F:\dcm4chee\dcm4chee-2.14.7-src\dcm4jboss-build\build.xml
<property name="dcm4chee-audit-login.lib"
value="F:/dcm4chee/dcm4chee-xds-1.0.0/server/default/lib"/>
<property name="dcm4chee-audit-logger.lib"
value="F:/dcm4chee/dcm4chee-xds-1.0.0/server/default/lib"/>
<property name="dcm4chee-audit-tomcat.lib"
value="F:/dcm4chee/dcm4chee-xds-1.0.0/server/default/lib"/>
<property name="dcm4chee-docstore.lib"
value="F:/dcm4chee/dcm4chee-xds-1.0.0/standalone/lib"/>
6. 用Ant Build代码,生成二进制包。
总结:
笔者根据自己原来的博文进行搭建,的确发现出了不少问题,其原因主要是对于 docstore, xds-infoset,audit-loger三个依赖的函数jar包的问题,原来的方式是
采用mvn工具直接编译这三个库的源代码,其中mvn会自动在线download一些依赖的文件,由于被依赖的文件的url更改而导致出错。所以,我在新的这篇文章剔除了这种方式,直接下载 dcm4chee-xds-1.0.0的二进制包,在该包中已经包含了上面几个依赖的jar包,所以必须手动修改build.xml文件使得能正确找到它们。
ps:这里感谢网友英子指出的一些文字错误。在原先的文档把dcm4chee的版本写成了2.17.1, 现在已更正过来。