maven项目,如何导入本地jar包

maven项目导入本地jar包,然后以pom坐标的方式引入项目。
  1. 为何有这种奇怪的需求?
maven 上找不到了对应的jar包了,没有对应的坐标。
  1. 导入方式
将你本地的项目放入maven仓库,使用maven命令。而不是简单的复制进maven仓库。
  1. 参数说明,-Dfile=你本地jar包的路径,-DgroupId=你取的分组名称,作为仓库项目名的区分,DartifactId=你的分组下的项目名。groupId,artifactId名称怎么取都行,只要你能好区分。你本地jar包的路径要对。
mvn install:install-file -Dfile=D:\smartupload.jar -DgroupId=sm -DartifactId=smartupload -Dversion=1.0 -Dpackaging=jar

    <dependency>
      <groupId>sm</groupId>
      <artifactId>smartupload</artifactId>
      <version>1.0</version>
    </dependency>

猜你喜欢

转载自blog.csdn.net/qq_44783283/article/details/108174642