zoukankan      html  css  js  c++  java
  • maven 引入外部jar包的几种方式

    一.dependency 本地jar包

    复制代码
    <dependency>
            <groupId>com.im</groupId>  <!--自定义-->
            <artifactId>sdk</artifactId>    <!--自定义-->
            <version>1.0</version> <!--自定义-->
            <scope>system</scope> <!--system,类似provided,需要显式提供依赖的jar以后,Maven就不会在Repository中查找它-->
            <systemPath>${basedir}/lib/sdk-1.0.jar</systemPath> <!--项目根目录下的lib文件夹下-->
        </dependency> 
    复制代码

    二.编译阶段指定外部lib

    复制代码
         <plugin>
         <artifactId>maven-compiler-plugin</artifactId>
         <version>2.3.2</version>
         <configuration>
         <source>1.8</source>
         <target>1.8</target>
         <encoding>UTF-8</encoding>
         <compilerArguments>
         <extdirs>lib</extdirs><!--指定外部lib-->
         </compilerArguments>
         </configuration>
         </plugin>
    复制代码

    三.将外部jar打入本地maven仓库

    mvn install:install-file -Dfile=sdk-1.0.jar -DgroupId=com.im -DartifactId=sdk -Dversion=1.0 -Dpackaging=jar

    引入jar包

    <dependency>
                <groupId>com.im</groupId>
                <artifactId>sdk</artifactId>
                <version>1.0</version>
            </dependency>

    转自:https://www.cnblogs.com/senlinyang/p/9197613.html

  • 相关阅读:
    ceph部署与问题
    openstack常见问题汇总
    css
    html
    zookeeper
    ZAB协议
    快速排序
    Servlet梳理
    tomcat性能优化梳理
    tomcat梳理
  • 原文地址:https://www.cnblogs.com/javalinux/p/14845393.html
Copyright © 2011-2022 走看看