Building along with Project Dependencies in Ant
I have a Java project that is dependent on other Java projects that are siblings and there is a chain of dependencies. Each individual project has a build script written in Ant. For clarity find below a sample of the same.
EARProject
depends onWebProject
andEJBProject
: Thewar
file that is generated by theWebProject
build andjar
file that is generated by theEJBProject
are needed to build theEARProject
.WebProject
depends onComponentOneProject
: Thejar
file that is generated by theComponentOneProject
build is needed to buildWebProject
.EJBProject
depends onComponentTwoProject
: Thejar
file that is generated by theComponentTwoProject
build is needed to buildEJBProject
.
So, when I build the EARProject
build, if the dependent war
and jar
have not been built yet, then it should k开发者_Go百科ick-off the WebProject
build and EJBProject
build and if the ComponentOneProject
is yet to be built, the build of ComponentOneProject
needs to be kicked-off and so on.
Can someone suggest a clean method by which we can accomplish this?
Facing the same problem we at our company wrote a custom Groovy script that explores the full dependency tree ant generates the Ant build scripts based on all the .project, .classpath, .settings/* files. This wasn't as difficult as it might seem as first. This way we can build our products without (My)Eclipse on a clean CVS+JDK+Groovy virtual machine. Hope it helps..
精彩评论