_positories ⽂件的作⽤Maven 修改setting ⽂件后本地仓。。。_positories ⽂件的作⽤/Maven 修改setting ⽂件后本地仓库缓存了jar 或pom 但还是去远程仓库获取
_positories ⽂件介绍
1. 结构构成:
举个栗⼦
2._remote.*和setting⽂件的py关系#Thu Jan 24 11:42:29 CST 2019logback-parent-1.1.1.pom>nexus-aliyun=logback-parent-1.1.1.pom>nexus-xx=logback-parent-1.1.1.pom>mirror-all=这⾥的nexus-aliyun 表⽰l 中配置的私服id
1
2
3
4
5其中这个⽂件存储的是每次从私服或者中央仓库下载的jar 包的信息。该logback-parent 只有pom 管理,所以没有jar 第3⾏:表⽰该pom 第⼀次从nexus-aliyun(阿⾥云镜像)来的第4⾏:表⽰更换远程仓库nexus-xx(xx 私服)且该私服存在该pom,那么就将该私服地址写⼊到_positories.第5⾏:表⽰镜像服务器mirror-all 存在该pom 只有存在该资源的镜像或私服才会将私服或镜像的id 写⼊到_positories 中参考资料:wwwblogs/mySummer/p/9453777.html
1
2
3
4
5
6
7
8
9
10
11
12
13Could not resolve dependencies for project com-hallo-mybatis:generator:jar:1.0-SNAPSHOT: The following artifacts could not be resolved: t.tsf:spring-cloud-tsf-dependencies:pom:1.1.1-RELEASE, t.tsf:spring-cloud-tsf-sleuth:jar:1.1.1-RELEASE, t.tsf:spring-cloud-tsf-auth:jar:1.1.1-RELEASE: Failure to t.tsf:spring-cloud-tsf-dependencies:pom:1.1.1-RELEASE in <span >***:8081/repository/public/ was cached in the local repository, resolution will not be reattempted until the update interval of public has elapsed or updates are forced</span>
1
2
3
4
5
6<mirrors>    <mirror>      <!-- * 表⽰我这个镜像服务器要代替所有的仓库 -->      <mirrorOf>*</mirrorOf>      <name>mirror-all</name>      <url>t/nexus/repository/maven-public/</url>      <id>custom</id>  </mirror>          <repositories>            <repository>                <id>central</id>                <url>/maven2</url>                <releases>                    <enabled>true</enabled>                </releases>                <snapshots>                    <enabled>true</enabled>                </snapshots>            </repository>        </repositories>
1
2
3
4
5
6
7
手机restricted access怎么办
8
mvvm模型9
10
11
12
13
14
15
16
17
18
19
20
3.maven setting配置⽂件 tips ★ 3.1 setting不配置镜像或仓库时,会⾃动请求apache的 3.2标签解读 <localRepository>本地仓库的路径
<pluginGroups>第三⽅插件的groupId(不常⽤)
<proxies>给maven配置代理(不常⽤)
<servers>远程仓库的配置⽂件(deploy构件时常⽤,需要配置私服的账号及密码)_positories 中>符号后的字符为setting ⽂件中配置的<mirror>标签下的id,也就是镜像服务器的id(⾃⼰定义),也可以是<repository>标签下的id,表⽰远程仓库的id(⾃⼰定义);具体看本地仓库的构件是从哪⾥下载的;
1
2<!-- 默认值为${user.home}/.m2/repository 。 -->windows ⽤户请注意,默认是在C 盘
1
2例如:以下为springBoot 的地址,但是为什么在idea 中却不⽤指定该groupId 也可以使⽤,  是因为boot 的maven 中指定了<goalPrefix>spring-boot</goalPrefix>命令前缀<pluginGroups>        <pluginGroup>org.springframework.boot</pluginGroup>  </pluginGroups>
1
2
3
4
5<!--⽤来配置不同的代理,多代理profiles 可以应对笔记本或移动设备的⼯作环境:通过简单的设置profile id 就可以很容易的更换整个代理配置。 --> <proxies>  <!--代理元素包含配置代理时需要的信息-->  <proxy>  <!--代理的唯⼀定义符,⽤来区分不同的代理元素。-->  <id>myproxy</id>  <!--该代理是否是激活的那个。true 则激活代理。当我们声明了⼀组代理,⽽某个时候只需要激活⼀个代理的时候,
该元素就可以派上⽤处。 -->  <active>true</active>  <!--代理的协议。 协议://主机名:端⼝,分隔成离散的元素以⽅便配置。-->  <protocol>http</protocol>  <!--代理的主机名。协议://主机名:端⼝,分隔成离散的元素以⽅便配置。  -->  <host>proxy.somewhere</host>  <!--代理的端⼝。协议://主机名:端⼝,分隔成离散的元素以⽅便配置。 -->  <port>8080</port>  <!--代理的⽤户名,⽤户名和密码表⽰代理服务器认证的登录名和密码。 -->  <username>proxyuser</username>  <!--代理的密码,⽤户名和密码表⽰代理服务器认证的登录名和密码。 -->  <password>somepassword</password>  <!--不该被代理的主机名列表。该列表的分隔符由代理服务器指定;例⼦中使⽤了竖线分隔符,使⽤逗号分隔也很常见。-->  <nonProxyHosts>*.</nonProxyHosts>  </proxy> </proxies>
1
2
3
4
5
6
7
8
idea配置artifacts
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<mirrors>镜像服务器地址(常⽤,⼀般配置aliyun镜像)
<repositories>仓库配置(常⽤,id与标签mirrorOf和_positories有关,repositories标签常配置在下)<!--配置服务端的⼀些设置。⼀些设置如安全证书不应该和l ⼀起分发。这种类型的信息应该存在于构建服务器上的l ⽂件中。--><servers> <!--服务器元素包含配置服务器时需要的信息 --> <server>  <!--这是server 的id (注意不是⽤户登陆的id ),该id 与distributionManagement 中repository 元素的id 相匹配。-->  <id>server001</id>  <!--鉴权⽤户名。鉴权⽤户名和鉴权密码表⽰服务器认证所需要的登录名和密码。 -->  <username>my_login</username>  <!--鉴权密码 。鉴权⽤
户名和鉴权密码表⽰服务器认证所需要的登录名和密码。密码加密功能已被添加到2.1.0 +。详情请访问密码加密页⾯-->  <password>my_password</password>  <!--鉴权时使⽤的私钥位置。和前两个元素类似,私钥位置和私钥密码指定了⼀个私钥的路径(默认是${user.home}/.ssh/id_dsa )以及如果需要的话,⼀个密语  <privateKey>${usr.home}/.ssh/id_dsa</privateKey>  <!--鉴权时使⽤的私钥密码。-->  <passphrase>some_passphrase</passphrase>  <!--⽂件被创建时的权限。如果在部署的时候会创建⼀个仓库⽂件或者⽬录,这时候就可以使⽤权限(permission )。这两个元素合法的值是⼀个三位数字,其
<filePermissions>664</filePermissions>  <!--⽬录被创建时的权限。 -->  <directoryPermissions>775</directoryPermissions> </server></servers>1
23
4
5
6
7
8
9
10
11
12
13
mybatis面试题sql优化
14
15
16
17
18
bottom line什么意思19
20可以配置多个镜像<mirrors>        <mirror>        <!--该镜像的唯⼀标识符。id ⽤来区分不同的mirror 元素。且与_positories 有关系 -->              <id>alimaven</id>              <!--被镜像的仓库的id 。例如,要设置为<repository>中id 为def 的仓库的景象,就需要将该元素设置成def 。表⽰为仓库def 的镜像,注意给该仓库设置镜像
<!-- 还有'*'表⽰镜像所有的仓库,'*,!def'表⽰镜像除def 仓库外的其他所有仓库(适合def 为私服时设置) -->              <mirrorOf>def</mirrorOf>              <name>aliyun maven</name>              <url>maven.aliyun/nexus/content/groups/public/</url>        </mirror>        ...</mirrors>1
2
3
4
5
6
7
8
9
10
11
12
13
<profiles>配置不同的profiles,使l配置和l进⾏联动
(在idea mavenProjects边栏中的profiles会出现这⾥设置的profiles的id,如下⾯的test,当被选中时它的值会覆盖任何其它定义在POM中或者l中的带有相同id的profile,通常配置在标签下)<!--远程仓库列表,它是Maven ⽤来填充构建系统本地仓库所使⽤的⼀组远程项⽬。 -->  <repositories>    <!--包含需要连接到远程仓库的信息 -->    <repository>    <!--远程仓库唯⼀标识-->    <id>codehausSn
apshots</id>    <!--远程仓库名称 -->    <name>Codehaus Snapshots</name>    <!--如何处理远程仓库⾥发布版本的下载-->    <releases>      <!--true 或者false 表⽰该仓库是否为下载某种类型构件(发布版,快照版)开启。  -->      <enabled>false</enabled>      <!--该元素指定更新发⽣的频率。Maven 会⽐较本地POM 和远程POM 的时间戳。这⾥的选项是:always (⼀直),daily (默认,每⽇),interval :X (这⾥      <updatePolicy>always</updatePolicy>      <!--当Maven 验证构件校验⽂件失败时该怎么做-ignore (忽略),fail (失败),或者warn (警告)。-->      <checksumPolicy>warn</checksumPolicy>    </releases>    <!--如何处理远程仓库⾥快照版本的下载。有了releases 和snapshots 这两组配置,POM 就可以在每个单独的仓库中,为每种类型的构件采取不同的策略。例    <snapshots>      <enabled/><updatePolicy/><checksumPolicy/>    </snapshots>    <!--远程仓库URL ,按protocol://hostname/path 形式 -->    <url>/maven2</url>    <!--⽤于定位和排序构件的仓库布局类型-可以是default (默认)或者legacy (遗留)。Maven 2为其仓库提供了⼀个默认的布局;然⽽,Maven 1.x 有⼀种不    <layout>default</layout>    </repository>  </repositories>  <!--发现插件的远程仓库列表。仓库是两种主要构件的家。第⼀种构件被⽤作其它构件的依赖。这是中央仓库中存储的⼤部分构件类型。另外⼀种构件类型是插
<pluginRepositories>    <!--包含需要连接到远程插件仓库的信息.参见profiles/profile/repositories/repo
sitory 元素的说明-->          <pluginRepository>                <releases>            <enabled/><updatePolicy/><checksumPolicy/>    </releases>    <snapshots>      <enabled/><updatePolicy/><checksumPolicy/>    </snapshots>    <id/><name/><url/><layout/>    \</pluginRepository></pluginRepositories>1
2
3
4
5
tcp网络协议
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41 <!--根据环境参数来调整构建配置的列表。l 中的profile 元素是l 中profile 元素的裁剪版本。它包含了id ,activation, repositories, pluginRepos <profiles> <!--根据环境参数来调整的构件的配置--> <profile>  <!--该配置的唯⼀标识符。 -->  <id>test</id>
1
2
3
4
5
6
<activeProfiles>使配置的profiles⼿动⽣效(注意,如果这⾥不启⽤某⼀个profile的话,profile下的repositories将不会⽣效,默认仓库还是
apache的默认仓库;另:这⾥设置的activeProfile会与l设置的profile产⽣联动,相同的id会被激活)
例:    <activeProfile>nexus</activeProfile>    <activeProfile>qcloud-repo</activeProfile>    <activeProfile>prd</activeProfile>  <!-- prd 的profile 在项⽬的l 中定义 --></activeProfiles>
1
2
3
4<!--⼿动激活profiles 的列表,按照profile 被应⽤的顺序定义activeProfile 。 该元素包含了⼀组activeProfile 元素,每个activeProfile 都含有⼀个profile id 。任何在a      profile 都会被激活。如果没有匹配的profile ,则什么都不会发⽣。例如,env-test 是⼀个activeProfile ,则在l (或者l )中对应id 的profile 会被
<activeProfiles> <activeProfile>env-test</activeProfile> <activeProfile>test</activeProfile></activeProfiles></settings>1
2
3
4
5
6
7