PS: Some jars do not support Maven
For example, kaptcha, a popular third-party Java library that is used to generate "captcha" images, is not in Maven's central repository.
Here's how to install the "kaptcha" jar into Maven's local repository.
1. mvn install
Download "kaptcha", unzip it and copy kaptcha-version.jar to C drive. Issue the following command:
mvn install:install-file -Dfile=c:\kaptcha-{version}.jar -DgroupId=com.google.code -DartifactId=kaptcha -Dversion={version} -Dpackaging=jar
Example:
D:\>mvn install:install-file -Dfile=c:\kaptcha-2.3.jar -DgroupId=com.google.code -DartifactId=kaptcha -Dversion=2.3 -Dpackaging=jar [INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'install'. [INFO] ------------------------------------------------------------------------ [INFO] Building Maven Default Project [INFO] task-segment: [install:install-file] (aggregator-style) [INFO] ------------------------------------------------------------------------ [INFO] [install:install-file] [INFO] Installing c:\kaptcha-2.3.jar to D:\maven_repo\com\google\code\kaptcha\2.3\kaptcha-2.3.jar [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: < 1 second [INFO] Finished at: Tue May 12 13:41:42 SGT 2014 [INFO] Final Memory: 3M/6M [INFO] ------------------------------------------------------------------------
Now, the "kaptcha" jar has been copied to the Maven local repository.
2. pom.xml
After installation, declare the kaptcha package in pom.xml.
<dependency> <groupId>com.google.code</groupId> <artifactId>kaptcha</artifactId> <version>2.3</version> </dependency>