下载jar包到本地。
然后通过如下命令进行安装。
mvn install:install-file -Dfile=jar包的位置 -DgroupId=一般是公司名倒序 -DartifactId=唯一型ID -Dversion=版本号 -Dpackaging=jar
例如:添加fastdfs的jar包
1,在jar包所在文件夹,点击鼠标右键-在此处打开命令窗口
2,输入命令
正常命令如下
mvn install:install-file -Dfile=fastdfs-client-java-1.27-RELEASE.jar -DgroupId=org.csource -DartifactId=fastdfs-client-java -Dversion=1.27-SNAPSHOT -Dpackaging=jar
在pom.xml中引用如下
<!-- https://mvnrepository.com/artifact/org.csource/fastdfs-client-java -->
<dependency>
<groupId>org.csource</groupId>
<artifactId>fastdfs-client-java</artifactId>
<version>1.27-RELEASE</version>
</dependency>
====================================================
--安装第三方jar包到私服
--在settings配置文件中添加登录私服第三方登录信息
<server>
<id>thirdparty</id>
<username>admin</username>
<password>admin123</password>
</server>
----进入jar包所在目录运行
mvn deploy:deploy-file -DgroupId=com.alibaba -DartifactId=fastjson -Dversion=1.1.37 -Dpackaging=jar -Dfile=fastjson-1.1.37.jar -Durl=http://localhost:8081/nexus/content/repositories/thirdparty/ -DrepositoryId=thirdparty
----打开cmd直接运行
mvn deploy:deploy-file -DgroupId=com.alibaba -DartifactId=fastjson -Dversion=1.1.37 -Dpackaging=jar -Dfile=C:\my_java\授课资料\资料:maven【高级】\安装第三方jar包\fastjson-1.1.37.jar -Durl=http://localhost:8081/nexus/content/repositories/thirdparty/ -DrepositoryId=thirdparty