Publishing local jar to your maven/m2 local repository

You will need to do this if you have a local jar file that is not in the Maven central repository and you need the maven build to work. This will also be useful if you are behind a firewall and do not have external access.

  • Download the jar file or scp the jar file to the build machine
  • At the same directory as the jar file, run the following command to install the jar to the local maven repository

mvn install:install-file -DgroupId= -DartifactId= -Dversion= -Dpackaging=jar -Dfile= -DgeneratePom=true

  • Now when you run your maven goals, it will not look for this specific jar file in any external repository.

Eclipse Users

If you want your Eclipse to start using this jar from your local repository

  • Eclipse Luna on a Mac, Window > Show View > Other > Maven > Maven Repositories > Local Repositories > Local Repository
  • Right click for the context menu and rebuild index

It should now show up if you try to add this dependency in your pom.xml

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s