A complex piece of software depends on external modules and libraries. For example, a lot of Java projects depend on popular libraries like Apache Commons, JDBC, Log4j etc., In any project, it makes sense to reuse the existing libraries instead of coding our own libraries from the scratch. For simple projects those depend on a couple of libraries, hands on dependency management works well. But when the project ends up with dozens of external libraries, managing their dependencies becomes laborious. Problem accentuates further when the project is developed by a team as developers tends add the external libraries independently of others and it is high time to move the projects to automated dependency management.
Apache Maven is by far the most popular build manager for Java projects which combines build manager with dependency manager. Maven follows Custom over Configuration approach, which means your project has to fall into certain customs or best practices dictated by Maven with less flexibility over configuration. It is the default choice for the developers who don’t mind adapting to certain customs. Maven also comes with other features like project information reports etc., to cover all aspects of a good build process.
Another equally popular build system is Apache Ant, which follows Configuration over Custom approach. Developers who like to configure the build system from scratch and wants a flexible build process prefer Ant over Maven. When you work with Ant, Apache Ivy is a good choice for automated dependency management.
Apache Ivy is a dependency manager from Apache and it gels perfectly with Apache Ant to automate dependency management to improve overall build system. Apache Ivy also has a Plugin for Eclipse, IvyDE, that plugs Apache Ivy into Eclipse.
If you have some compelling reasons to use Apache Ant and Ivy as the build system then go with them otherwise use Apache Maven as the build system. Apache Maven is easy to learn and adapt. To learn more about it see CodeTab Apache Maven Tutorial
Automated Dependency Management
Developers who are not introduced to automated dependency management normally maintains a lib directory and place all essential libraries like apache-commons, jdbc drivers, dom4j, log4j etc., with corresponding source, javadoc jars. For each project, they copy the required jars to project workspace and add them to project build path. If they require IDE context help feature, then they also have to link the respective source and javadoc in the IDE. In this approach, developer has to be careful to include proper version of these libraries in build file to avoid runtime errors in production. No doubt, whole process is fraught with pitfalls.
To improve the productivity and to avoid build issues, move to automated dependency management with Apache Ivy and IvyDE, which streamlines the whole process. All that is required is to add an ivy.xml file to the project and to its build path. This simple file lists the dependencies and versions. When the project requires a new library, just add the dependency line for that library to ivy.xml and Ivy syncs the whole system. Housekeeping of libraries is no longer necessary as Apache Ivy fetches the dependencies, its source and javadoc jars from public repositories and adds them to the project. It also cache them for future use by other projects.
About Apache Ivy Tutorial
Apache Ivy is highly configurable and a powerful piece of software. The Ivy official site has some excellent tutorials and detailed reference documentation, but multiple configurable options and coupled with some of the difficult concepts overwhelms the beginners, who usually find it difficult to get them right in the first go. This tutorial helps the beginners as well as intermediate users to easily get over the tough spots of Apache Ivy.
Apache Ivy Tutorial is also a step-by-step Beginners Guide that explains how to set up Ivy and use it to automate dependency management either through command line (CLI) or with IvyDE Plugin for Eclipse. It also covers some of the frequently encountered concepts like Apache Ivy Local Repository, Shared Repository, Patterns and Resolvers.
Basic objective of Apache Ivy Beginners Guide it to provide a clear understanding of Apache Ivy for the beginners and intermediate users. Once you are comfortable with the basic concepts, it enables you to explore the advanced features of Apache Ivy by going through official Reference documentation and other resources. As such, in all the examples we have used a minimal set of configurations to complete a given task.