maven 私服nexus 上传、下载 第三方jar包及springboot的依赖配置

1. 下载私服上的jar包

只需要 配置 maven 的 settings.xml

注意:仓库url地址是从 nexus后台 上创建仓库后得到的

<!-- 在 profiles 标签里 新加 profile文件 -->
<profile>   
	<!--profile的id-->
	<id>dev</id>   
	<repositories>   
	  <repository>  
		<!--仓库id,repositories可以配置多个仓库,保证id不重复-->
		<id>nexus</id>   
		<!--仓库地址,即nexus仓库组的地址-->
		<url>http://192.168.0.250:8081/repository/server/</url>   
		<!--是否下载releases构件-->
		<releases>   
		  <enabled>true</enabled>   
		</releases>   
		<!--是否下载snapshots构件-->
		<snapshots>   
		  <enabled>true</enabled>   
		</snapshots>   
	  </repository>   
	</repositories>  
	<pluginRepositories>  
		<!-- 插件仓库,maven的运行依赖插件,也需要从私服下载插件 -->
		<pluginRepository>  
			<!-- 插件仓库的id不允许重复,如果重复后边配置会覆盖前边 -->
			<id>public</id>  
			<name>Public Repositories</name>  
			<url>http://192.168.0.250:8081/repository/server/</url>  
		</pluginRepository>  
	</pluginRepositories>  
</profile>


<!-- 在 settings 标签 里启用上面配置的 profile -->
<activeProfiles>
	<activeProfile>dev</activeProfile>
</activeProfiles>

如果配置了没有生效,很大可能是你的IDE软件没有引用 这个maven的配置,idea默认就是用的自带的maven插件,可以直接idea maven插件里面的settings.xml或者改成你自己下载的maven。

2. 上传私服的jar包

2.1 除了引入上面的settings.xml的配置,还需要加入对私服的访问权限信息
<!-- 在 servers 标签 里添加 -->
<server>
 <id>releases</id>
  <username>username</username>
  <password>123456</password>
</server>
<server>
  <id>snapshots</id>
  <username>username</username>
  <password>123456</password>
</server>
2.2 配置maven项目的 pom.xml文件
<!-- 直接在 project 标签中配置即可 -->
<distributionManagement>
    <repository>
        <id>releases</id>
        <name>Nexus Release Repository</name>
        <url>http://192.168.0.250:8081/repository/server/</url>
    </repository>
    <snapshotRepository>
        <id>snapshots</id>
        <name>Nexus Snapshot Repository</name>
        <url>http://192.168.0.250:8081/repository/server/</url>
    </snapshotRepository>
</distributionManagement>
2.3 配置好后,就可以直接通过IDEA的 deploy部署推送到私服仓库了

在这里插入图片描述

嗯,没有第三步了,此处单纯记录下maven对阿里云仓库的配置

a. 全局配置方式修改 maven的settings.xml

<mirror>  
  <id>alimaven</id>  
  <name>aliyun maven</name>  
  <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
  <mirrorOf>central</mirrorOf>          
</mirror>

b. 单个项目配置方式,可直接修改pom.xml文件

<repositories>
    <repository>
        <id>alimaven</id>
        <name>aliyun maven</name>
        <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
    </repository>
</repositories>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值