How to include custom library into maven local repository?– turn

Original address: https://www.mkyong.com/maven/how-to-include-library-manully-into-maven-local-repository/

There are 2 cases that you need to issue Maven’s command to include a jar into the Maven local repository manually.

P.S Trust me,there are still many jars that doesn’t support Maven.

Case study

For example,a popular third party Java library,which is used to generate “captcha” image to stop spam,but it’s not available in the Maven center repository.

In this tutorial,we will show you how to install the “kaptcha” jar into your Maven’s local repository.

1. mvn install

Download the ““,extract it and copy the kaptcha-version.jar to somewhere else,for example,c drive. Issue following command :

Demo.

mvn install:install-file -Dfile

Now,the "kaptcha" jar is copied to your Maven local repository.

2. pom. xml

After installed,just declares the kaptcha coordinate in pom. xml.

     com.google.code
     kaptcha
     2.3 

3. Done

Build it,Now the "kaptcha" jar is able to retrieve from your Maven local repository.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>