Still you will find jars which are not there in Maven repository. Classic example is suppose you create a common utility jar and you want to use it across projects or it could be a third party jar which has private licence and so cannot be there in Maven central repository.
In above cases, you can actually put the required jar easily in the Maven local repository. For demonstration purpose, we are using Kaptcha.
Here is the command:
Remember to remove the newlines from above command incase you are copying and pasting.
Below is the result from command line after executing the command:
Here is the command:
mvn install:install-file -Dfile=c:\kaptcha-2.3.2.jar -DgroupId=com.google -DartifactId=kaptcha -Dversion=2.3.2 -Dpackaging=jar
Remember to remove the newlines from above command incase you are copying and pasting.
Below is the result from command line after executing the command:
C:\>mvn install:install-file -Dfile="c:\kaptcha-2.3.2.jar" -DgroupId=com.google -DartifactId=kaptcha -Dversion=2.3.2 -Dpackaging=jar [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building Maven Stub Project (No POM) 1 [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-install-plugin:2.3.1:install-file (default-cli) @ standalone-po m --- [INFO] Installing c:\kaptcha-2.3.2.jar to C:\Users\dharmvir.singh\.m2\repository \com\google\kaptcha\2.3.2\kaptcha-2.3.2.jar [INFO] Installing C:\Users\DHARMV~1.SIN\AppData\Local\Temp\mvninstall71581647865 23828175.pom to C:\Users\dharmvir.singh\.m2\repository\com\google\kaptcha\2.3.2\ kaptcha-2.3.2.pom [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.587s [INFO] Finished at: Tue Oct 23 15:23:57 IST 2012 [INFO] Final Memory: 3M/15M [INFO] ------------------------------------------------------------------------Job is done. You can now specify the dependency of this jar as shown:
com.google kaptcha 2.3.2