Managing dependencies using Maven

12 June 2008

Maven can manage all jar file dependencies for the build machines. Let me explain how to do this.

We use dependency element to refer to a jar file which reside in a remote repository. It is said that in near future, the dependencies will extend beyond jar files. Maven places the jar files (fetched from remote repository) on the local repository. The element has three child elements, , , and . Maven looks in the remote repository for a directory with the same name as the . Under that directory, it looks for a jars subdirectory. Inside the jars directory should be a jar file that has the filename id-version.jar. In the given example, the defined first dependency will look for ant-1.4.1.jar in the remote repository. The url element is used for documentation only.

<dependencies >
<dependency >
<id >ant </id >
<version >1.4.1 </version >
<url >http://jakarta.apache.org/ant/ </url >
</dependency >
 
<dependency >
<id >commons-beanutils </id >
<version >1.4 </version >
</dependency >
 
<dependency >
<id >commons-collections </id >
<version >2.0 </version >
<url >http://jakarta.apache.org/commons/collections.html </url >
</dependency >
 
<dependency >
<id >commons-configuration </id >
<version >1.0-dev </version >
<url >http://jakarta.apache.org/commons/ </url >
</dependency >
…
<dependencies>

del.icio.us:Managing dependencies using Maven  digg:Managing dependencies using Maven  spurl:Managing dependencies using Maven  wists:Managing dependencies using Maven  simpy:Managing dependencies using Maven  newsvine:Managing dependencies using Maven  blinklist:Managing dependencies using Maven  furl:Managing dependencies using Maven  reddit:Managing dependencies using Maven  fark:Managing dependencies using Maven  blogmarks:Managing dependencies using Maven  Y!:Managing dependencies using Maven  smarking:Managing dependencies using Maven  magnolia:Managing dependencies using Maven  segnalo:Managing dependencies using Maven  gifttagging:Managing dependencies using Maven

Top Of Page | Trackback

If you found this page useful, consider linking to it. Simply copy and paste the code below into your web site.

It will look like this: Managing dependencies using Maven

Leave a Reply