安装
maven项目中添加自己的jar包
比如,自己打了一个jar包叫:mytools.jar。
安装该jar包到maven的本地仓库中:
mvn install:install-file -Dfile=d:/tmp/mytools.jar -DgroupId=com.xxx -DartifactId=mytools -Dversion=1.0 -Dpackaging=jar
#file:你的jar包在自己硬盘的位置
#groupId,artifactId,version:当然就是对应着pom文件中的相应参数了
执行完以上命令,就可以在pom文件中引用自己的jar包了:
<dependency>
<groupId>com.xxx</groupId>
<artifactId>mytools</artifactId>
<version>1.0</version>
</dependency>
或者配置成本地包依赖
在项目中创建lib目录,把需要的包添加进去
然后,在pom中写:
<dependency>
<groupId>com.xxx</groupId>
<artifactId>mytools</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/mytools.jar</systemPath>
</dependency>