您的位置:首页 > 其它

部署nexus,完成局域网maven仓库布置。

2017-11-03 15:00 387 查看
为什么要搭建nexus私服,有些公司不能访问外网。那就有必要在局域网里找一个能访问外网权限的机器。搭建nexus私服,开发人员能连到这台私服上,通过这个私服访问远程仓库。

1.下载安装包nexus-2.14.5-02,下载地址:http://www.sonatype.org/nexus/go 

2.打开目录E:\MAVEN\nexus-2.14.5-02-bundle\nexus-2.14.5-02\bin\jsw,我使用的是



3.在文件夹windows-x86-64下面有以下的文件,



先启动start-nexus

再安装install-nexus

如果不想用了就

先停止stop-nexus

再卸载uninstall-nexus

4.访问http://localhost:8081/nexus,右上角有个Login in,默认用户名:admin   密码是admin123  

把Repository下面的所有仓库的属性 Download Remote Indexes设置成true



5. maven的配置文件settings.xml

<?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"> <!-- localRepository
| The path to the local repository maven will use to store artifacts.
|
| Default: ${user.home}/.m2/repository-->
<localRepository>E:\MAVEN\mvn_repo</localRepository>

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

<mirrors>

<!--
指定所有的jar都会在配置的nexus镜像中进行下载
只要mirrorOf中的工厂需要下载jar,都会自动来找该镜像。如果镜像地址有,就下载下来。
若镜像地址没有,mirrorOf中的工厂也不会到中央资源库下载,而是由镜像去下载。这是推荐做法。
若镜像下载不到,就下载失败。
-->
<mirror>
<id>UFindNexus</id>
<mirrorOf>*</mirrorOf>
<url>http://127.0.0.1:8081/nexus/content/groups/public/</url

>
</mirror>
</mirrors>

<profiles>
<profile>
<id>UFindNexus</id>

<!--仓库地址-->
<repositories>
<repository>
<id>UFindNexus</id>
<url>http://127.0.0.1:8081/nexus/content/groups/public</url

>
<releases>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<checksumPolicy>fail</checksumPolicy>
</snapshots>
</repository>
</repositories>

<!--插件地址-->
<pluginRepositories>
<pluginRepository>
<id>UFindNexus</id>
<url>http://127.0.0.1:8081/nexus/content/groups/public</url

>
<releases>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<checksumPolicy>fail</checksumPolicy>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>

<!--生效-->
<activeProfiles>
<activeProfile>UFindNexus</activeProfile>
</activeProfiles>

</settings>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: