mavean导入本地仓库

当你刚开始用mavean的时候可能还没有发现mavean导入本地仓库方法的重要性,但是随着经常使用mavean项目就会发现,有些jar包mavean从网上的mavean仓库中无法导入,例如oracle的jar等等。

mavean导入本地仓库方法:

1.在电脑上打开DOS命令窗口

2.输入如下命令

mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>

解释上面的命令:

mvn install:install-file 
  -Dfile=jar包的位置 
  -DgroupId=在pom.xml的groupId 
  -DartifactId=在pom.xml的artifactId 
  -Dversion=在pom.xml的version 
  -Dpackaging=jar

举个例子:

mvn install:install-file -Dfile=C:Users
aymondactivation.jar -DgroupId=activation -DartifactId=activation -Dversion=1.0.2 -Dpackaging=jar

在pom.xml中输入

    <dependency>
        <groupId>activation</groupId>
        <artifactId>activation</artifactId>
        <version>1.0.2</version>
    </dependency>

执行上面的mvn语句后,如果出现下面图片中箭头所指的SUCCESS就成功了,否则失败,查看原因。

3.在pom.xml输入

<dependency>
       <groupId>-DgroupId的值</groupId> 
    <artifactId>-DartifactId的值</artifactId>
   <version>-Dversion的值</version>
</dependency>
原文地址:https://www.cnblogs.com/javJoker/p/7145203.html