maven仓库和私服配置迷惑详解

maven 安装目录里面settings配置意义和单项说明

一 localRepository

在这里插入图片描述

配置本地仓库:意思说maven打包什么的首先放到本地仓库里面去 以后寻找也会首先从本地仓库里面找!
D:/install/apache-maven-3.8.2/maven_repository

二、镜像地址

marrorof 特别重要 代表要代理仓库类型
我们会从mirros 第一个代理地址寻找 会首次从aliyun maven中找

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

私服地址配置生效原则

首先位置很重要 第一个是我们私服地址 如果只配置次选项
如果我们删掉本地仓库后只配置私服镜像
如果说service依赖dao 现在我们把本地仓库里面的dao删除
在这里插入图片描述
然后执行service install

在这里插入图片描述
我们发现会从阿里云上找
在这里插入图片描述
发现找不到

<mirrors>
   <mirror>
        <id>public</id>
        <mirrorOf>*</mirrorOf>
        <name>Public Repositories</name>
        <url>http://192.168.0.24:8081/nexus/content/groups/public/</url>
    </mirror>
    <mirror>
        <id>alimaven</id>
        <mirrorOf>central</mirrorOf>
        <name>aliyun maven</name>
        <url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
    </mirror>
    <mirror>
        <id>repo1</id>
        <mirrorOf>central</mirrorOf>
        <name>Human Readable Name for this Mirror.</name>
        <url>http://repo1.maven.org/maven2/</url>
    </mirror>
    <mirror>
        <id>repo2</id>
        <mirrorOf>central</mirrorOf>
        <name>Human Readable Name for this Mirror.</name>
        <url>http://repo2.maven.org/maven2/</url>
    </mirror>
</mirrors>

三、私服地址生效处理需要配置第一镜像之外,还需要方式一全局配置---->maven安装目录 conf–>setting里面

<profiles>
		<profile>
			<id>dev</id>
			<repositories>
				<repository>
					<id>Public Repositories</id>
					<url>http://192.168.0.24:8081/nexus/content/groups/public/</url>
					<releases>
						<enabled>true</enabled>
					</releases>
					<snapshots>
						<enabled>true</enabled>
					</snapshots>
				</repository>
			</repositories>
			<pluginRepositories>
				<pluginRepository>
					<id>Public Repositories</id>
					<url>http://192.168.0.24:8081/nexus/content/groups/public/</url>
					<releases>
						<enabled>true</enabled>
					</releases>
					<snapshots>
						<enabled>true</enabled>
					</snapshots>
				</pluginRepository>
			</pluginRepositories>
		</profile>
	</profiles>
	<activeProfiles>
		<activeProfile>dev</activeProfile>
	</activeProfiles>

四、私服地址生效处理需要配置第一镜像之外,还需要方式二局部配置(和三说明二选一)---->modle目录pom中配置

project目录下即可

public333 Public Repositories333 http://192.168.0.24:8081/nexus/content/groups/public/ public Public Repositories http://192.168.0.24:8081/nexus/content/groups/public/

五 配置本地镜像地址是为了让本地项目代理地址走这个镜像 ,不配置镜像也没问题。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值