Maven 手动安装本地jar包到本地仓库

前提描述:

maven项目需要引入jar包,该jar包是其他相关项目打包而来(自己开发的jar包)。

解决办法:

通过mvn的install-file命令即可完成上述任务,

完整的命令格式如下:mvn install:install-file  -Dfile=your-jar-file-path  -DgroupId=com.your.group  -DartifactId=your-artifactId -Dversion=x.x -Dpackaging=jar -DlocalRepositoryPath=your repository

  • -Dfile 需要放入maven仓库jar包的位置
  • -DgroupId对应为pom文件中的groupId
  • -DartifactId对应为pom文件中的artifactId
  • -Dversion对应为pom文件中的version
  • -Dpackaging导入包的类型是jar包的话就是jar
  • -DlocalRepositoryPath:本地仓库路径

举例:

<dependency>
    <groupId>com.souche</groupId>
    <artifactId>msgcenter-sdk</artifactId>
    <version>1.2.6-SNAPSHOT</version>
</dependency>

命令:

mvn install:install-file 
-Dfile=/Users/lmfeng/Documents/msgcenter-sdk-java/target/msgcenter-sdk-1.2.6-SNAPSHOT.jar
-DgroupId=com.souche 
-DartifactId=msgcenter-sdk 
-Dversion=1.2.6-SNAPSHOT 
-Dpackaging=jar 
-DlocalRepositoryPath=C:\Users\xxxx\.m2\repository

 

 

参考地址:https://blog.csdn.net/yyongsheng/article/details/128645315

posted @ 2023-07-24 09:35  啄木鸟伍迪  阅读(681)  评论(0)    收藏  举报
//火箭 GenerateContentList();