Social Media

Maven – Directly Adding a Jar To Your Local Repository

I recently had a need to add fakereplace to my local repository as a test –

[sourcecode language=”lang='xml”] <dependency>
<groupId>org.fakereplace</groupId>
<artifactId>fakereplace</artifactId>
<version>1.0.0.Alpha2</version>
</dependency>
[/sourcecode]

The problem was that I didnt want to use a remote repository, so used the following command to add it direct to the local repository –

mvn install:install-file \
-DgroupId=org.fakereplace \
-DartifactId=fakereplace \
-Dpackaging=jar \
-Dversion=1.0.0.Alpha2 \
-Dfile=fakereplace-1.0.0.Alpha2.jar \
-DgeneratePom=true

Navigating to \org\fakereplace\fakereplace confirmed its installation

About the Author Martin Farrell

My name is Martin Farrell. I have almost 20 years Java experience. I specialize inthe Spring Framework and JEE. I’ve consulted to a range of businesses, and have provide Java and Spring mentoring and training. You can learn more at About

follow me on:

Leave a Comment: