Dependency management is , like its name suggests ,
Managing the project dependencies in a centralized storage.For example, if we are using spring-1.2.8 in our projects A and B. Then assume spring 1.2.8 has dependencies of commons-logging-1.0.4 and log4j.1.12 dependencies. So what we have to do is , we should have a lib folder inside our projects and have these all dependencies into it. So what are the headaches for doing this.
- You have to keep remember of these dependencies each every time you add a new lib. For example if you are going to have new dependency like foo.jar , the you should know which are the dependencies of foo.jar.
- You have to keep jar files in your project repositories. For example, we may need to keep spring jars for all the project repositories which uses spring.
- Switching from one version to another is very difficult. For example I am moving from spring 1.2.8 to spring 2.0 version. Then again I have to add the new dependencies to my project dependency folder.
- Maintaining project artifacts is difficult. For example we have sub modules a, b and c in our project and we need to b and c jars for building a, we may need to build the b and c first before build the a.jar, even though we haven't changed the code base of b and c.
Above are few of the many problems we face when we don't have a centralized dependency management system.
So now lets discuss the advantages of having a centralized dependency management system.
If we have a dependency management system , then all of our artifacts (For us, it is mostly jar files) are in the central repository (Another svn repository). Every artifact has a configuration file where you have your dependency information. This is an extract of a configuration file for a sample. (This is taken from one of our projects etl-server)
So lets list down the point now.
1) Using dependency management we can maintain the centralized repository. So in your project page, you only need to use a XML file listing your dependencies. Ivy will take care of downloading them from the dependency repository when we build the project using ant.
2) Ivy maintains a local cache directory (possibly inside your
3) To publish your project artifact to repository is as easy as using an ant command publish!
4) Due to the chain of dependencies concept, if you refer one artifact foo.jar in your dependency file, then whatever the dependencies needed for foo.jar will be taken care of foo's dependency file. You don't need to keep them inside your dependency file.So it makes your life much easier.
So for more details it is better to have a go through the IVY DOC site before we discuss this matter in to more detail.
No comments:
Post a Comment