• How to include library manually into maven local repository?


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

    How to include library manually into maven local repository?

        How to include library manually into maven local repository?
        Published: May 12, 2009 , Updated: April 14, 2011 , Author: mkyong

        There are still many Java libraries that are not support for Maven, or may be you want to create a custom library which is required to include it into your Maven local repository.

        Fortunately, Maven comes with command to let you include your “non-maven-support” library into your Maven local repository easily.
        Case study

        For example, “kaptcha” is a third party library which is used to generate “captcha” image to stop spamming, but it did not support Maven.

        Here’s a guide to show you how to install the “kaptcha” jar into your Maven’s local repository.
        1. Install library – mvn install

        Download the “kaptcha” jar file and put it into your “C:” drive, and issue following Maven’s command :

        mvn install:install-file -Dfile=c:\kaptcha-2.3.jar -DgroupId=com.google.code
        -DartifactId=kaptcha -Dversion=2.3 -Dpackaging=jar

        Result :

        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 2009
        [INFO] Final Memory: 3M/6M
        [INFO] ------------------------------------------------------------------------

        Now, the “kaptcha” jar library is included into your Maven local repository.
        2. Modify pom.xml file

        After installed, you can add the custom library details into your “pom.xml” file like this

        <dependency>
              <groupId>com.google.code</groupId>
              <artifactId>kaptcha</artifactId>
              <version>2.3</version>
        </dependency>

        3. Done

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

  • 相关阅读:
    使用 @Autowired 的时候,到底是写接口还是实现类?
    socket的简单例子
    java 将文件夹所有的文件合并到指定的文件夹下
    java 复制某一文件夹下的所有文件到另一个文件夹下
    java Date日期总结的一些转换的方法
    java 可排序的数值得字符串,转化成list集合后进行的排序的几种方法
    java 查看文件的大小的方法
    java 从一个总的list集合中,去掉指定的集合元素,得到新的集合
    java 可拆成数组的字符串,去掉重复元素的一种方法
    将博客搬至CSDN
  • 原文地址:https://www.cnblogs.com/lexus/p/2358531.html
Copyright © 2020-2023  润新知