有时候,我们需要依赖我们自定义的Jar时,maven仓库是没有的,所以我们需要手动安装Jar包。使用命令如下:
mvn install:install-file -Dfile=mrlocateStand.jar -DgroupId=com.bonc -DartifactId=mrlocate -Dversion=1.0 -Dpackaging=jar -DlocalRepositoryPath=D:\m2\repository -Dfile.encoding=UTF-8
在Jar所在目录下 cmd
-Dfile=jar名称
-DgroupId=可自定义(com.mace)
-DartifactId=可自定义(redisApp)
-Dversion=版本号可自定义(1.0)
-Dpackaging=jar
-DlocalRepositoryPath=指定maven仓库地址(D:\m2\repository)
-Dfile.encoding=UTF-8=可指定项目编码
然后正常依赖即可
<dependency>
<groupId>com.bonc</groupId>
<artifactId>mrlocateStand</artifactId>
<version>1.0</version>
</dependency>