Monday, September 21, 2009

Adding System Dependencies in Maven POM

When using Maven as a Project Management/Build System, the dependencies of a project should be available in either a local or a remote repository. But in some cases we might have dependencies on some arbitrary libraries which might not be part of any repositories.
If you have the library (.jar), you can specify a system dependency (good old ANT class path style) without even installing/deploying the libraries into your repositories.
Consider a maven project like this(in picture) where the dependencies(.jar) are maintained in a lib folder.
2009-09-21_123913
Here is how the dependencies are to be specified in the pom.xml. Note that ${basedir} is a maven system property to denote the base directory of the project.
<dependency>
<groupId>org.igniterealtime</groupId>
<artifactId>smack</artifactId>
<version>3.1.0</version>
<scope>system</scope>
<systemPath>${basedir}/lib/smack.jar</systemPath>
</dependency>
<dependency>
<groupId>org.igniterealtime</groupId>
<artifactId>smackx</artifactId>
<version>3.1.0</version>
<scope>system</scope>
<systemPath>${basedir}/lib/smackx.jar</systemPath>
</dependency>



No comments: