Windows下使用Nexus2.11私服搭建
下载地址:http://pan.baidu.com/s/1mgirYAG
1. 解压下载的文件后为nexus-2.11.3-01.zip和sonatype-work.zip
将两个文件选中解压到一个文件夹里
2. 访问 http://repo.maven.apache.org/maven2/.index/ 下载中心仓库最新版本的索引文件,在一长串列表中,我们需要下载如下两个文件(一般在列表的末尾位置,注意.gz下载完的文件大小在185M左右,如果用迅雷下载可能只有130M左右无法使用)
nexus-maven-repository-index.gz
nexus-maven-repository-index.properties
3. 下面就是解压这个索引文件,虽然后缀名为gz,但解压方式却比较特别,我们需要下载一个jar包indexer-cli-5.1.1.jar,我们需要通过这个特殊的jar来解压这个索引文件
将上面三个文件(.gz & .properties & .jar)放置到同一目录下,运行如下命令
java -jar indexer-cli-5.1.1.jar -u nexus-maven-repository-index.gz -d indexer
等待程序运行完成之后可以发现indexer文件夹下出现了很多文件,将这些文件放置到{nexus-home}/sonatype-work/nexus/indexer/central-ctx目录下(放之前将这里面的所有文件先删除,否则不会生效,这些文件nexus启动就会合并删除),重新启动nexus
./nexus restart
上面3个文件的下载地址http://pan.baidu.com/s/1pJknKhX
4. 安装nexus到windows
在G:\nexus-2.11.3-01\nexus-2.11.3-01\bin\jsw下根据自己的操作系统选择进入,双击install-nexus.bat,点击start-nexus启动nexus或者右击计算机-->管理—>服务nexus启动(可设置自动启动),
输入http://localhost:8081/nexus进入主页
点击右上角login 用户名/密码:admin/admin123
5. 仓库设置
点击左侧的repositories
除了mvnrepository是我自己添加的,其他的都是默认的,选择central,然后选择下面的configuration
点击保存
上面为配置好后jar包下载存放的位置,自己修改的路径写在下面的框中即可
右击central更新索引 update index,下面的browse Index下central有包即成功
6. 安装配置maven(下载解压配置环境变量即可 省略)和settings.xml配置
在<profile></profile>中添加
<repositories>
<repository>
<id>central</id>
<name>central</name>
<url>http://localhost:8081/nexus/content/groups/public/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<snapshotPolicy>always</snapshotPolicy>
</repository>
</repositories>
<activeProfiles>
<activeProfile>central</activeProfile>
</activeProfiles>
<mirror></mirror>添加
<mirror>
<id>nexus</id>
<mirrorOf>central</mirrorOf>
<name>nexus</name>
<url>http://localhost:8081/nexus/content/groups/public/</url>
</mirror>