关于maven的仓库的详解,基于nexus
2017-09-19 09:09
204 查看
<!--可以在父类设置一个nexus的私有工厂 -->
<!-- <repositories>
<repository>
<id>nexus</id>
<name>nexus Repository</name>
localhost可以是任意的ip,它都会去相应工厂找
<url>http://localhost:8081/nexus/content/groups/public/</url>
<releases>
默认是打开的,他会下载releases版本的
<enabled>true</enabled>
</releases>
<snapshots>
默认是false,
<enabled>true</enabled>
</snapshots>
</repository>
</repositories> -->
<!--只有这里激活了相应id才说明使用那个的私服-->
<activeProfiles>
<activeProfile>nexusRep</activeProfile>
</activeProfiles>
上面的问题是当其它没继承的模块或其他项目时又需要设置一遍,因此可以通过去maven的setting.xml中设置私服,当需要那个仓库管理器统一激活
<!-- 在这里建立不同的私服,这里为nexus的-->
<profile>
<id>nexusRep</id>
<repositories>
<repository>
<id>nexus</id>
<name>nexus Repository</name>
<!-- localhost可以是任意的ip,它都会去相应工厂找-->
<url>http://localhost:8081/nexus/content/groups/public/</url>
<releases>
<!-- 默认是打开的,他会下载releases版本的 -->
<enabled>true</enabled>
</releases>
<snapshots>
<!-- 默认是false, -->
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
<!--只有这里激活了相应id才说明使用那个的私服-->
<activeProfiles>
<activeProfile>nexusRep</activeProfile>
</activeProfiles>
当你的私服nexus关闭了,它会去maven的maven-model-builder-3.5.0.jar\org\apache\maven\model \pom-4.0.0.xml中的配置的中央工厂找。
如果你不允许直接去中央工厂找,必须通过私服(nexus)找,当私服找不到时就停止下载依赖包,就需要在settings.xml配置镜像
<!--*代表所有激活的工厂,url设置为只能下载依赖包的私服-->
<!-- <mirror>
<id>nexusMirror</id>
<mirrorOf>*</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://localhost:8081/nexus/content/groups/public/</url>
</mirror>-->
<!-- 在这里建立不同的私服,这里为nexus的-->
<profile>
<id>nexusRep</id>
<repositories>
<repository>
<id>nexus</id>
<name>nexus Repository</name>
<!-- localhost可以是任意的ip,它都会去相应工厂找-->
<url>http://localhost:8081/nexus/content/groups/public/</url>
<releases>
<!-- 默认是打开的,他会下载releases版本的 -->
<enabled>true</enabled>
</releases>
<snapshots>
<!-- 默认是false, -->
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
<!--把maven-model-builder-3.5.0.jar\org\apache\maven\model \pom-4.0.0.xml的中央工厂设置一下-->
<!--<profile>
<id>centralRep</id>
<repositories>
<repository>
<id>central</id>
<name>Central Repository</name>
<url>*</url>
<layout>default</layout>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>-->
<activeProfiles>
<activeProfile>nexusRep</activeProfile>
</activeProfiles>
<!-- <repositories>
<repository>
<id>nexus</id>
<name>nexus Repository</name>
localhost可以是任意的ip,它都会去相应工厂找
<url>http://localhost:8081/nexus/content/groups/public/</url>
<releases>
默认是打开的,他会下载releases版本的
<enabled>true</enabled>
</releases>
<snapshots>
默认是false,
<enabled>true</enabled>
</snapshots>
</repository>
</repositories> -->
<!--只有这里激活了相应id才说明使用那个的私服-->
<activeProfiles>
<activeProfile>nexusRep</activeProfile>
</activeProfiles>
上面的问题是当其它没继承的模块或其他项目时又需要设置一遍,因此可以通过去maven的setting.xml中设置私服,当需要那个仓库管理器统一激活
<!-- 在这里建立不同的私服,这里为nexus的-->
<profile>
<id>nexusRep</id>
<repositories>
<repository>
<id>nexus</id>
<name>nexus Repository</name>
<!-- localhost可以是任意的ip,它都会去相应工厂找-->
<url>http://localhost:8081/nexus/content/groups/public/</url>
<releases>
<!-- 默认是打开的,他会下载releases版本的 -->
<enabled>true</enabled>
</releases>
<snapshots>
<!-- 默认是false, -->
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
<!--只有这里激活了相应id才说明使用那个的私服-->
<activeProfiles>
<activeProfile>nexusRep</activeProfile>
</activeProfiles>
当你的私服nexus关闭了,它会去maven的maven-model-builder-3.5.0.jar\org\apache\maven\model \pom-4.0.0.xml中的配置的中央工厂找。
如果你不允许直接去中央工厂找,必须通过私服(nexus)找,当私服找不到时就停止下载依赖包,就需要在settings.xml配置镜像
<!--*代表所有激活的工厂,url设置为只能下载依赖包的私服-->
<!-- <mirror>
<id>nexusMirror</id>
<mirrorOf>*</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://localhost:8081/nexus/content/groups/public/</url>
</mirror>-->
<!-- 在这里建立不同的私服,这里为nexus的-->
<profile>
<id>nexusRep</id>
<repositories>
<repository>
<id>nexus</id>
<name>nexus Repository</name>
<!-- localhost可以是任意的ip,它都会去相应工厂找-->
<url>http://localhost:8081/nexus/content/groups/public/</url>
<releases>
<!-- 默认是打开的,他会下载releases版本的 -->
<enabled>true</enabled>
</releases>
<snapshots>
<!-- 默认是false, -->
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
<!--把maven-model-builder-3.5.0.jar\org\apache\maven\model \pom-4.0.0.xml的中央工厂设置一下-->
<!--<profile>
<id>centralRep</id>
<repositories>
<repository>
<id>central</id>
<name>Central Repository</name>
<url>*</url>
<layout>default</layout>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>-->
<activeProfiles>
<activeProfile>nexusRep</activeProfile>
</activeProfiles>
相关文章推荐
- Maven 本地仓库,远程仓库,中央仓库,Nexus私服,镜像 详解
- maven 中手动添加JAR包到本地仓库详解
- Maven私有仓库-使用docker部署Nexus
- Maven详解之仓库------本地仓库、远程仓库
- maven 私有仓库 nexus 安装失败的原因以及提供最新版的nexus
- 使用nexus作为maven私有中央仓库,启动出错
- Maven之——Nexus创建仓库
- 使用Nexus搭建Maven本地仓库
- 关于Maven本地仓库中存在依赖时,重新下载was cached in the local repository错误
- 使用Nexus管理Maven仓库时,上传带依赖的第三方jar
- Nexus搭建私有maven仓库
- maven私有仓库快速使用指南(nexus)
- Nexus 私有仓库搭建与 Maven 集成
- jar 上传到Maven 仓库(Nexus 3.x),第三方引用 笔记
- Nexus 私有仓库搭建与 Maven 集成
- 关于Maven中的常见命令,通过命令的方式快速创建一个空的maven工程,将jar包打到maven仓库中
- 使用nexus搭建maven仓库(本地私服)
- Nexus 搭建maven 私有仓库
- 详解Maven仓库之本地仓库、远程仓库
- 基于Maven的pom.xml文件详解