zoukankan      html  css  js  c++  java
  • Maven配置多个远程仓库的实现方法

    起因

    由于公司原因,很多jar包都是内部开源,外部非开源情况,所以很多jar包都在aliyun的远程仓库中找不到。但是又因为回家后,自己写的很多demo都是用的一些公司仓库里没有的jar。所以就想着配置多个Maven仓库镜像地址,从而解决反复切换仓库一问题。

    <mrrior></mrrior>配置多个镜像问题
    这里必须要提醒!mrrior标签配置多个,生效的只有第一个!只有第一个仓库无法访问的时候,才会使用第二个。注意是无法访问的时候,如果能访问,但是仓库中没有你要找的包,他不会去访问第二个仓库!

    <profile></profile>配置多镜像
    这里推荐使用profile属性进行多镜像配置。

    <profiles>
        <profile>
            <!-- id必须唯一 -->
            <id>aliyunRepository</id>
            <repositories>
                <repository>
                    <!-- id必须唯一 -->
                    <id>myRepository1_1</id>
                    <!-- 仓库的url地址 -->
                    <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                        <updatePolicy>always</updatePolicy>
                    </snapshots>
                </repository>
            </repositories>
        </profile>
        <profile>
            <!-- id必须唯一 -->
            <id>companyRepository</id>
            <repositories>
                <repository>
                    <!-- id必须唯一 -->
                    <id>myRepository2_1</id>
                    <!-- 仓库的url地址 -->
                    <url>你们另一个仓库的地址</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                        <updatePolicy>always</updatePolicy>
                    </snapshots>
                </repository>
            </repositories>
        </profile>
      </profiles>
    
        <activeProfiles>
        <!-- 激活myRepository2 -->
        <activeProfile>companyRepository</activeProfile>
        <!-- 激活myRepository1 -->
        <activeProfile>aliyunRepository</activeProfile>
      </activeProfiles>
  • 相关阅读:
    设计模式----工厂模式
    设计模式----简单工厂
    log4net使用详解
    link/Extended dependency 无法显示连接
    Abp框架之执行Update-Database 命令系列错误
    Index API
    使用Java客户端操作elasticsearch(二)
    elasticsearch之分词插件使用
    使用Java Low Level REST Client操作elasticsearch
    js如何获取隐藏的元素的高度
  • 原文地址:https://www.cnblogs.com/panchanggui/p/14704334.html
Copyright © 2011-2022 走看看