settings中的配置

1、映射阿里中央仓库(下载jar包快一点)

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

2、配置本地仓库(无需联网使用jar包)

<localRepository>E:\maven_repository</localRepository>

3、登录私服:

<server>
    <id>releases</id>
    <username>admin</username>
    <password>admin123</password>
</server>

<server>
    <id>snapshots</id>
    <username>admin</username>
    <password>admin123</password>
</server>

4、在客户端的 setting.xml 中配置私服的仓库(用于本地项目依赖私服项目)

</profiles>
   <profile> 
		<!--profile 的 id-->
		<id>dev</id> 
		
		<repositories> 
			<repository> 
				<!--仓库 id,repositories 可以配置多个仓库,保证 id 不重复-->
				<id>nexus</id> 
				<!--仓库地址,即 nexus 仓库组的地址-->
				<url>http://ip:8081/repository/my-repo/</url> 
				
				<!--是否下载 releases 构件-->
				<releases> 
					<enabled>true</enabled> 
				</releases> 
				
				<!--是否下载 snapshots 构件-->
				<snapshots> 
					<enabled>true</enabled> 
				</snapshots> 
			</repository> 
		</repositories> 
		
		<pluginRepositories> 
			<!-- 插件仓库,maven 的运行依赖插件,也需要从私服下载插件 -->
			<pluginRepository> 
				<!-- 插件仓库的 id 不允许重复,如果重复后边配置会覆盖前边 -->
				<id>public</id> 
				<name>Public Repositories</name> 
				<url>http://ip:8081/repository/my-repo/</url> 
			</pluginRepository> 
		</pluginRepositories> 
	</profile>
</profiles>

5、激活仓库

<activeProfiles>
   <activeProfile>dev</activeProfile>
</activeProfiles>
Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐