maven引入外部jar包

一、仅本地

 cmd进入jar包所在目录,执行下列命令

-Dfile:本地jar包名称     -DgroupId:groupId    -DartifactId:artifactId

 mvn install:install-file -Dfile=test.jar -DgroupId=com.csdn.test -DartifactId=test -Dversion=1.0 -Dpackaging=jar

引入依赖

<dependency> 
  <groupId>com.csdn.test</groupId>  
  <artifactId>test</artifactId>  
  <version>1.0</version> 
</dependency>

二、maven 私服 nexus 添加第三方jar包

登录Nexus后,点击右侧的“Repositories”,显示当前Nexus所管理的Repository:

默认情况下Nexus为我们创建了以下主要的Repository:

1、PublicRepositories,这是一个Repository Group,该Repository  Group包含了多个Repository,其中包含了Releases、Snapshots、ThirdParty和Central。

2、3rd party,该Repository即是存放你公司所购买的第三方软件库的地方,它是一个由Nexus自己维护的一个Repository。

3、Apache Snapshots,看名字你就应该知道这是个什么样的Repository,这是一个代理Repository,即最终的依赖还是得在Apache官网上去下载,然后缓存在Nexus中。

4、Central,这就是代理Maven Central Repository的Repository。

5、Releases,你自己的项目要发布时,就应该发布在这个Repository,他也是Nexus自己维护的Repository,而不是代理。

6、Snapshots,你自己项目Snapshot的Repository。

使用3rd party上传第三方jar包

使用第三方jar包

参考:https://www.cnblogs.com/cb0327/p/5395335.html

发布了48 篇原创文章 · 获赞 34 · 访问量 18万+

猜你喜欢

转载自blog.csdn.net/u014481096/article/details/80226294