使用Nexus创建私服

1.下载并且解压缩


 

 

2.添加NEXUS_HOME和Path


 

 

3.nexus intall将nexus安装到windows-x86-32服务中,双击install-nexus.bat


 

4.nexus start & stop


 

5.在nexus服务启动后,可以输入http://localhost:8081/nexus,就能看到Nexus的界面


 

6.登录Nexus,admin/admin123


 

7.更新私有仓库的索引

先选中Central,切换到Configuration页签,将Download Remote Indexes设置为true,save;

当然,也可以更换Remote Storage Location,默认为http://repo1.maven.org/maven2/

常用的Maven仓库有:

共有的仓库
http://repo1.maven.org/maven2/
http://repository.jboss.com/maven2/
http://repository.sonatype.org/content/groups/public/
http://mirrors.ibiblio.org/pub/mirrors/maven2/org/acegisecurity/
http://maven.glassfish.org/content/groups/glassfish/

https://nexus.sourcesense.com/nexus/content/repositories/public/

私有的仓库
http://repository.codehaus.org/
http://snapshots.repository.codehaus.org/
http://people.apache.org/repo/m2-snapshot-repository
http://people.apache.org/repo/m2-incubating-repository/

 

之后分别对Apache Snapshots、Codehaus Snapshots进行同样的操作。


 save之后,可以查看Scheduled Tasks正在下载索引。

 右击Central,Update Index,可以查看Scheduled Tasks正在更新索引(这个过程会很漫长)。

 当任务消失的时候,就表明索引更新完成了,可以使用本地Nexus搜索构件。


 

8.配置Maven从Nexus下载构件

在${用户}\.m2目录下的settings.xml中配置Nexus仓库,并配置镜像让Maven只使用私服

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" 
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
...
  
  <mirrors>
	 <mirror>
      <id>nexus</id>
      <mirrorOf>*</mirrorOf>
      <name>Human Readable Name for this Mirror.</name>
      <url>http://localhost:8081/nexus/content/groups/public</url>
    </mirror>
  </mirrors>
  
  <profiles>
	<profile>
		<id>nexus</id>
		<repositories>
			<repository>
			  <id>central</id>
			  <url>http://central</url>
			  <releases>
				<enabled>true</enabled>
			  </releases>
			  <snapshots>
				<enabled>true</enabled>
			  </snapshots>
			</repository>
        </repositories>
		<pluginRepositories>
			<pluginRepository>
			  <id>central</id>
			  <url>http://central</url>
			  <releases>
				<enabled>true</enabled>
			  </releases>
			  <snapshots>
				<enabled>true</enabled>
			  </snapshots>
			</pluginRepository>
        </pluginRepositories>
	</profile>
  </profiles>
  
  <activeProfiles>
    <activeProfile>nexus</activeProfile>
  </activeProfiles>

...  
</settings>

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值