加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

How to include custom library into maven local repository?--

发布时间:2020-12-14 06:23:01 所属栏目:Java 来源:网络整理
导读:原文地址: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. The jar you want to use

原文地址: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.

  1. The jar you want to use doesn’t exist in the Maven center repository.
  2. You created a custom jar,and need to use for another Maven project.

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
     
     2.3

3. Done

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读