Sounds simple, but these dependencies can get out of hand. The Tree of DependenciesĪny Java project of reasonable complexity has a non-trivial set of dependencies consisting of JAR files with the internal resources needed to build, deploy, and run an application. When you think about it, complex dependency issues don't have a lot to do with design and coding, so it's natural to think about using a tool for this often tedious task.Īs your code grows, it acquires what's called a tree of dependencies. However, a point tends to come when dependency management really needs to be automated.
APACHE ANT IVY MANUAL
If, like me, you prefer to exert a lot of control over your code dependencies, then the manual path is attractive, at least initially. Managing code dependencies generally boils down to a simple choice: manual or automatic. We'll also examine the workflow for using Internet repositories, such as Maven Central. A little later in this article, we'll look at a concrete Eclipse example that illustrates the key role automatic dependency management can play in fixing these knotty issues. How often have you struggled with Eclipse or some other IDE, trying to get rid of the compilation error markers in your Java files? This problem is often caused by missing (or incorrect) dependency errors.
APACHE ANT IVY HOW TO
Before we get into the details of how to work with Ant/Ivy, let's look a little at the area of dependency management in general. Also, the Ant/Ivy combination is a good example of the old UNIX principle of doing one thing and doing it well: Ant is a solid build tool, and Ivy is likewise a reliable dependency manager.īecause of their close relationship, Ivy even comes with a set of pre-built Ant tasks to help you get started using Ivy. This approach can make them a little easier to understand, particularly when things go wrong. With Ant and Ivy, each tool is dedicated to doing just one thing. However, the combined tool may be a little harder to use than is the case for the individual tools. With just one tool, you have a kind of one-stop shop. There are pros and cons to using two tools as opposed to one. Maven, on the other hand, is both a build tool and a dependency manager. For a brief example of Maven in action, see my article " Java Data Validation Using Hibernate Validator."Īnt is a build tool and Ivy is a dependency management tool.