Social Media

Category Archives for BuildTools

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