maven手动添加jar包到库

有的时候,maven的包在中央库中找不到的话,需要手动添加,方法如下,以添加oracle包到本地仓库为例:


1)在某个目录下,先放置好oracle 11g的驱动
2) 然后编写pom.xml文件

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.oracle</groupId>
  <artifactId>oracle11g</artifactId>
  <version>11.1.0.7.0</version>
  <name>oracle</name>
</project>

 3) 然后如下命令安装就可以了: 
    mvn install:install-file -DgroupId=com.oracle -DartifactId=oracle11g  -Dversion=11.1.0.7.0 -Dpackaging=jar -Dfile=oracle11g.jar 

猜你喜欢

转载自it4j.iteye.com/blog/2104262