File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Ant, Maven and Other Build Tools and the fly likes Ant builds and dependent projects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Ant builds and dependent projects" Watch "Ant builds and dependent projects" New topic

Ant builds and dependent projects

Brian Mulholland
Ranch Hand

Joined: Mar 12, 2009
Posts: 61
So I have a webapp project (lets call it A) that uses two other projects (let's call them B and C). B also depends on C. I am working in eclipse (speciifcally IBM's RAD). Right now, people are copying the jar from C into A and B and copying B into A. I can't depend that workspaces will always have all three projects, so i don't want to have project links, JARs is right. But I want to set up ant scripts so that if you had whatever combination of these projects in your workspace, as you made changes and build, JARs would be copied (if changed) into the projects that depend on them. I have an Ant build script for B and C, have added copy functions to them that are conditional, and even added a conditional copy ant script to A that does not build, but is triggered by the build.

But how can I control order? How can i make it so that if project C is modified that it will build first, andcopy into B and A and then trigger the build of B, which in turn copies, and then A gets built? And is my general approach right or is there a better practice?
Jayesh A Lalwani
Saloon Keeper

Joined: Jan 17, 2008
Posts: 2746

Use Maven. Maven is designed to solve problems like these.
Peter Johnson

Joined: May 14, 2008
Posts: 5852

And use Maven in conjunction with a CI tool such as Jenkins. Jenkins understands Maven POM files are can automatically rebuilt (and retest) modules that depends on other modules.

JBoss In Action
I agree. Here's the link:
subject: Ant builds and dependent projects
It's not a secret anymore!