maven 使用本地包 lib jar包 依赖一个lib目录

解决方法:

1. 把本地的lib加入maven编译时的依赖路径

如下配置:

     <plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
<compilerArguments>
<extdirs>lib/</extdirs>
</compilerArguments>
</configuration>
</plugin>

  

2. 本地system 配置

这种的不好处是,只能加入某个jar包而不是某个目录

<dependency>
<groupId>org.swinglabs</groupId>
<artifactId>swingx</artifactId>
<version>0.9.2</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/swingx-0.9.3.jar</systemPath>
</dependency>

  

3. 把jar包安装入本地仓库

  - 先安装jar包到本地仓库

  - 引用安装的jar包

注意: 正规maven的方法,要求jar包中有合法的 artifactId信息

<repository>
<id>repo</id>
<releases>
<enabled>true</enabled>
<checksumPolicy>ignore</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<url>file://${project.basedir}/repo</url>
</repository>

4. 使用install  插件  (推荐使用)

配置如下:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<executions>
<execution>
<id>install-external</id>
<phase>clean</phase>
<configuration>
<file>${basedir}/lib/app-0.0.1.jar</file>
<repositoryLayout>default</repositoryLayout>
<groupId>com.dalong.locallib</groupId>
<artifactId>appbanner</artifactId>
<version>0.0.1</version>
<packaging>jar</packaging>
<generatePom>true</generatePom>
</configuration>
<goals>
<goal>install-file</goal>
</goals>
</execution>
</executions>
</plugin>

  

5. 使用命令

mvn install:install-file  -Dfile=D:/jar/xxx.jar  -DgroupId=xxx.xxx  -DartifactId=xxx -Dversion=x.x -Dpackaging=jar

  

既使用maven又使用本地Jar包的更多相关文章

  1. maven pom 引入本地jar包

    maven pom 引入本地jar包 在pom.xml同级目录下新建lib文件夹,并放入本地jar包. 配置Jar包的dependency,包括groupId,artifactId,version三个 ...

  2. springboot(六) Maven打包引入本地jar包

       springboot Maven打包引入本地jar包 最近在做项目的时候,有一些jar包不存在maven的依赖库中,所以需要自己引入本地jar包来达到需求,那么我们该如何去将本地的jar包引入s ...

  3. Maven中安装本地Jar包到仓库中或将本地jar包上传

    摘要 maven install 本地jar 命令格式 mvn install:install-file -DgroupId=<group_name> -DartifactId=<a ...

  4. maven上传本地jar包到私服

    场景 1. 本地jar包上传到私服 思路: 1. maven的settting.xml配置私服的帐号密码 2. pom.xml配置上传的地址 3. 执行 mvn deploy 部署jar包到私服 步骤 ...

  5. Maven中使用本地JAR包

    在Maven项目中使用本地JAR包有两种方法: 1. 使用system scope <dependencies> <dependency> <groupId>org ...

  6. Maven之——使用本地jar包并打包进war包里面的方法

    转载请注明出处:http://blog.csdn.net/l1028386804/article/details/52594602 很显然,这种方法是很不可取的,因为Maven是用来团队合作,以及发布 ...

  7. maven加载本地jar包到repository

    maven加载本地jar到repository 这是一个常见场景,此处以本地opencv jar文件导入repository为例 1.Ubuntu下 mvn install:install-file ...

  8. (转)通过maven,给没有pom文件的jar包生成pom文件,maven项目引入本地jar包

    文章完全转载自 : https://blog.csdn.net/qq_31289187/article/details/81117478 问题一: 经常遇到公司私服或者中央仓库没有的jar包,然后通过 ...

  9. maven笔记-将本地jar包打包进可执行jar中

    参考资料:http://www.cnblogs.com/richard-jing/archive/2013/01/27/Maven_localjar.html 使用本地jar <dependen ...

随机推荐

  1. Laravel登录验证碰到的坑 哈希验证匹配问题

    用laravel 写登录验证 本来是用Crypt加密 添加用户到数据库的 后来验证密码  解密时一直报错 The payload is invaild 由于本人是laravel框架小白 自己思考许久未 ...

  2. PetShop的系统架构设计

    <解剖PetShop>系列 一.PetShop的系统架构设计 http://www.cnblogs.com/wayfarer/archive/2007/03/23/375382.html ...

  3. attr和prop

    <div class="content-item active"> <table class="table"> <thead> ...

  4. 整理一下以前的Html+css3复习笔记

    一.html5新特性  常用语义标签:nav footer header section mark  功能标签 video audio iframe canvas(画布和绘图功能)  input新ty ...

  5. 初次使用InstallShield笔记

    公司的产品需要打包发布,以前一直没打包,打包方法的学习交给了我 下面的内容是我研究过后的,通过回忆写的笔记.由于不熟悉,可能会有错误或者是笨办法,希望高手指正,感激不尽. 有些东西是什么,以及是什么意 ...

  6. Appcan 3.2 Switch操作

    Appcan3.0,有了很多不错的东西,但官方的文档还是那么的不靠谱. 我将记录下,我学习到的东西. 显示2个switch <div class="ub ub-pe"> ...

  7. SSL/TLS 高强度加密: 常见问题解答

    关于这个模块 mod_ssl 简史 mod_ssl会受到Wassenaar Arrangement(瓦森纳协议)的影响吗? mod_ssl 简史 mod_ssl v1 最早在1998年4月由Ralf ...

  8. 从0到1---“保多多”APP的开发(二)

    今天继续记录宝多多开发过程中的一些值得注意的知识点: 1.验证车牌格式的正则表达式函数: //车牌号验证 - (BOOL)validateCarNo:(NSString *)carNo { NSStr ...

  9. Javascript中封装window.open的例子

    对window.open进行封装, 使其更好用, 且更兼容, 很多人说window.open不兼容,其实不是, 因为不能直接执行, 必须通过用户手动触发才行;看代码: 代码如下 复制代码 var op ...

  10. tar.gz file installation

    1. tar xzvf  filename.tar.gz 2. cd filename 3. ./configure ./configure --prefix="path" 4. ...