Maven配置多个仓库方式

公司部署了一个私有仓库,但是需要挂VPN,VPN还有时间限制,时不时就断了,每次引用新的Jar包就要登录VPN,很麻烦,但是有些包直接aliyun也能下载,所以配置多个仓库,省得没必要的时候还挂VPN。

<settings> 
	<localRepository>C:\\Data\\Soft\\Maven\\data</localRepository> 
    <profiles>
        <profile>
            <id>xxx</id>
            <repositories>
                <repository>
                    <id>nexus_public</id>
                    <url>http://maven.xxx.com/repository/maven-public/</url>
                    <releases>
                        <enabled>true</enabled>
						<updatePolicy>always</updatePolicy>
                    </releases>
                    <snapshots>
						<enabled>true</enabled>
					</snapshots>    
				</repository>
			</repositories>
			<pluginRepositories>
				<pluginRepository>
					<id>nexus_public</id>
					<url>http://maven.xxx.com/repository/maven-public/</url>
					<releases>
						<enabled>true</enabled>
					</releases>
					<snapshots>
						<enabled>true</enabled>
					</snapshots>
				</pluginRepository>
			</pluginRepositories>
		</profile>
		<profile>
            <id>aliyun</id>
            <repositories>
                <repository>
                    <id>nexus_aliyun</id>
                    <url>https://maven.aliyun.com/nexus/content/groups/public/</url>
                    <releases>
                        <enabled>true</enabled>
						<updatePolicy>always</updatePolicy>
                    </releases>
                    <snapshots>
						<enabled>true</enabled>
					</snapshots>    
				</repository>
			</repositories>
		</profile>
	</profiles>
	<!-- xxx 即为公司的私有仓库 -->
	<activeProfiles>  
        <activeProfile>xxx</activeProfile>  
        <activeProfile>aliyun</activeProfile>  
    </activeProfiles>  
</settings>

上述配置就会先去下载公司私库,如果不能下载再去搜索阿里云的。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值