我有一个具有两个依赖项的 WebApp,如下所示。我想使用 Ant + Ivy 构建一个用于在 Tomcat 上部署的 war 文件。
+
+-MyWebApp // this Dynamic Java Web Application (deployed Tomcat and launches
// a thread contained in MyApp)
+-MyApp // this is just a vanilla Java Application
+-MyCommonStuff // these are common classes shared between MyApp and MyWebApp
// Ex. Database access code & business classes
使用 Ant 文档,我研究了如何为每个项目创建适当的 build.xml 文件。换句话说,每个项目都有一个独立的 build.xml,所以为了构建整个项目,我所要做的就是:
mkdir build
cd build
export SOME_COMMONBASE=`pwd`
svn co https://mybuildmachine.lan/svn/mycommonstuff mycommonstuff
cd mycommonstuff
ant
cd ..
% this produces mycommonstuff.jar
svn co https://mybuildmachine.lan/svn/myapp myapp
cd myapp
ant
cd ..
% this produces myapp.jar
svn co https://mybuildmachine.lan/svn/mywebapp mywebapp
cd mycommonstuff
ant
cd ..
% this produces mywebapp.war and deploys it to Tomcat
现在我想做的就是把它们放在一起,这样我就可以开始一个构建了。从表面上看,我应该能够以某种方式创建一个 Ivy build.xml 将依赖项连接在一起。但是,我已经阅读了 Ivy 文档并在 Google 上搜索了示例,但我仍然对如何完成这项任务一无所知。有人可以给我一些关于如何做到这一点的指示吗?