Sometimes there is a dependency not available at a remote repository and one is too lazy to set up a local maven repository – that’s when one adds a directory in the project structure and wants maven to find dependencies there.
- Create a directory called “lib” in the project root
- Add the following markup to the pom.xml inside the <repositories>-Tag (create if it does not exist):
- Assuming you’ve got a jar file with artifactId=mylibrary, groupId=com.hascode.plugin and a version=1.0.0 you should first rename your jar file to artifactId-version.jar – in the given example this would be mylibrary-1.0.0.jar
- In the next step you should create a specific directory structure in your lib folder : Create a sub directory for each part of your groupId, then inside a directory named after the artifactId and inside of this one a directory named after the version. Put the jar in this last directory!
- You should now be able to build your project with the bundled dependency .. if you’re using the Maven Eclipse Plugin a refresh of the Maven configuration might be needed…
Tags: Build, deployment, Development, Java, maven, repository