星空网 > 软件开发 > ASP.net

maven依赖本地非repository中的jar包

MAVEN 
今天在使用maven编译打包一个web应用的时候,碰到一个问题: 
项目在开发是引入了依赖jar包,放在了WEB-INF/lib目录下,并通过buildpath中将web libariary导入。 
eclipse中开发没有问题,但是使用maven编译插件开始便宜总是报找不到WEB-INF/lib这个jar包中的类。 
显然实在编译的时候WEB-INF/lib并没有配置到maven-complier-plugin插件src目录中去, 
于是将这个目录添加进去,还是不好使。无赖,先把这个jar包安装到本地库中,然后添加dependency。 

后来google了下,发现maven提供了scope为system的依赖,文档的原文如下: 
system 
This scope is similar to provided except that you have to provide the JAR which contains it explicitly. 
The artifact is always available and is not looked up in a repository. 

这样就可以添加dependency下载地址 而不需要再将WEB-INF/lib目录下的jar包安装到本地库中了。 
具体配置录下: 

<dependency> <groupId>org.apache</groupId> <artifactId>test</artifactId> <version>1.0</version> <scope>system</scope> <systemPath>${basedir}/src/main/webapp/WEB-INF/lib/paypal_base.jar</systemPath> </dependency> !更好的方式是配置编译参数<compilerArguments>,添加extdirs将jar包相对路径添加到配置中,如下:<build>    <plugins>      <plugin>       <artifactId>maven-compiler-plugin</artifactId>       <configuration>         <source>1.6</source>         <target>1.6</target>         <encoding>UTF-8</encoding>         <compilerArguments>          <extdirs>src\main\webapp\WEB-INF\lib</extdirs>         </compilerArguments>       </configuration>      </plugin>    </plugins>  </build>

 




原标题:maven依赖本地非repository中的jar包

关键词:maven

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

跨境电商如何解决物流痛点?:https://www.goluckyvip.com/news/603.html
关于进口圣诞树,沙特海关明确回复“不行”:https://www.goluckyvip.com/news/6030.html
国际物流货物尺寸怎么测量?海运价格年前全线上涨!:https://www.goluckyvip.com/news/6031.html
更新!shopee各大站点退货退款流程以及相关费用:https://www.goluckyvip.com/news/6032.html
被骗金额达到53000美元!新加坡现假冒ShopeePay应用程序诈骗:https://www.goluckyvip.com/news/6033.html
Lazada越南站开启新年促销,这些品类增长最猛:https://www.goluckyvip.com/news/6034.html
海陵岛马尾岛景点介绍 海陵马尾岛图片:https://www.vstour.cn/a/363177.html
无锡旅游景点竹海 - 无锡的竹海:https://www.vstour.cn/a/363178.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流