Maven3 安装使用(三)--搭建公司局域网maven服务器
2014-05-15 16:46
369 查看
四、搭建公司局域网的Maven服务器
如果在公司里使用Maven,通常应该在本地架设一个Maven资源仓库服务器,在代理远程资源仓库的同时维护本地资源仓库。
第一步: 下载Nexus
从http://nexus.sonatype.org/downloads/下载最新版本的Nexus
如:http://nexus.sonatype.org/downloads/nexus-oss-webapp-1.9.2.4-bundle.zip
前面说已经安装JDK1.6这是nexus所依赖的
解压 到目录 D:\nexus\nexus-oss-webapp-1.9.2.4
Nexus安装目录总有一个兄弟目录,名为“sonatype-work”。这个目录包含有所有资源库和Nexus的配置信息。
第二步:运行服务器
进入到以下目录位置:
D:\nexus\nexus-oss-webapp-1.9.3.4\bin\jsw
在windows系统下,选择自己机器32位还是64位
运行Nexus.bat打开
黑屏下没有报错信息就说明启动成功,默认端口号为0.0.0.0:8081
启动以后,Nexus将处于运行状态并在8081端口上监听为当前主机配置的所有IP地址(0.0.0.0)。要使用Nexus,首先打开一个浏览器,键入URL:http://localhost:8081/nexus。(也可用127.0.0.1或其他配置的IP地址)。这时会打开Nexus的初始欢迎界面。
点击右上方,log in 弹出登录框,默认的用户名:admin ,密码 :admin123
第三步:添加索引
在左侧栏中,选择【Repositories】,右侧会打开用户管理的资源列表。找到上述的三个远程资源库,在下方的属性窗口,将“Download Remote Indexes”设为“true”,并保存修改。
Apache Snapshots
Codehaus Snapshosts
Maven Central
Nexus能够将多个仓库,hosted或者proxy合并成一个group,这样,Maven只需要依赖于一个group,便能使用所有该group包含的仓库的内容。
Nexus预定义了“Public Repositories”仓库组,默认合并所有预定义的Release仓库。
点击列表中的“Public Repositories”,然后选择下方的"Configuration" Tab,在配置面板中,将右边“Avaiable Repositories”中的资源库移动到左边的“Ordered Group Repository”中
如果我们调整Nexus用于局域网内部开发,我们应该配置一个单一的Nexus组,让它包含release和snapshot。要达到这个目的,添加snapshot资源库到我们的公共组(public group),并向Maven的设置文件~/.m2/settings.xml中(Maven 3.0.3 为MAVEN安装目录\conf\settings.xml)添加如下的镜像配置:
<settings>
<mirrors>
<mirror>
<!--This sends everything else to /public -->
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://服务器IP地址:8081/nexus/content/groups/public</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<!--Enable snapshots for the built in central repo to direct -->
<!--all requests to nexus via the mirror -->
<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>
<!--make the profile active all the time -->
<activeProfile>nexus</activeProfile>
</activeProfiles>
</settings>
这样配置以后,让团队中所有开发者都指向Nexus中的Public Repository,以后不管我们怎样调整Nexus中的资源库,都不需要团队中的开发者改变他们的本地配置。而管理者对团队应该使用哪个/哪些资源就有了更多地控制。
如果在公司里使用Maven,通常应该在本地架设一个Maven资源仓库服务器,在代理远程资源仓库的同时维护本地资源仓库。
第一步: 下载Nexus
从http://nexus.sonatype.org/downloads/下载最新版本的Nexus
如:http://nexus.sonatype.org/downloads/nexus-oss-webapp-1.9.2.4-bundle.zip
前面说已经安装JDK1.6这是nexus所依赖的
解压 到目录 D:\nexus\nexus-oss-webapp-1.9.2.4
Nexus安装目录总有一个兄弟目录,名为“sonatype-work”。这个目录包含有所有资源库和Nexus的配置信息。
第二步:运行服务器
进入到以下目录位置:
D:\nexus\nexus-oss-webapp-1.9.3.4\bin\jsw
在windows系统下,选择自己机器32位还是64位
运行Nexus.bat打开
黑屏下没有报错信息就说明启动成功,默认端口号为0.0.0.0:8081
启动以后,Nexus将处于运行状态并在8081端口上监听为当前主机配置的所有IP地址(0.0.0.0)。要使用Nexus,首先打开一个浏览器,键入URL:http://localhost:8081/nexus。(也可用127.0.0.1或其他配置的IP地址)。这时会打开Nexus的初始欢迎界面。
点击右上方,log in 弹出登录框,默认的用户名:admin ,密码 :admin123
第三步:添加索引
在左侧栏中,选择【Repositories】,右侧会打开用户管理的资源列表。找到上述的三个远程资源库,在下方的属性窗口,将“Download Remote Indexes”设为“true”,并保存修改。
Apache Snapshots
Codehaus Snapshosts
Maven Central
Nexus能够将多个仓库,hosted或者proxy合并成一个group,这样,Maven只需要依赖于一个group,便能使用所有该group包含的仓库的内容。
Nexus预定义了“Public Repositories”仓库组,默认合并所有预定义的Release仓库。
点击列表中的“Public Repositories”,然后选择下方的"Configuration" Tab,在配置面板中,将右边“Avaiable Repositories”中的资源库移动到左边的“Ordered Group Repository”中
如果我们调整Nexus用于局域网内部开发,我们应该配置一个单一的Nexus组,让它包含release和snapshot。要达到这个目的,添加snapshot资源库到我们的公共组(public group),并向Maven的设置文件~/.m2/settings.xml中(Maven 3.0.3 为MAVEN安装目录\conf\settings.xml)添加如下的镜像配置:
<settings>
<mirrors>
<mirror>
<!--This sends everything else to /public -->
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://服务器IP地址:8081/nexus/content/groups/public</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<!--Enable snapshots for the built in central repo to direct -->
<!--all requests to nexus via the mirror -->
<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>
<!--make the profile active all the time -->
<activeProfile>nexus</activeProfile>
</activeProfiles>
</settings>
这样配置以后,让团队中所有开发者都指向Nexus中的Public Repository,以后不管我们怎样调整Nexus中的资源库,都不需要团队中的开发者改变他们的本地配置。而管理者对团队应该使用哪个/哪些资源就有了更多地控制。
相关文章推荐
- Maven3 安装使用(三)--搭建公司局域网maven服务器
- Maven3 安装使用(三)--搭建公司局域网maven服务器
- Maven3 安装使用(三)--搭建公司局域网maven服务器
- CentOS 7下快速安装Gitlab,搭建个人或者公司内部使用的Git服务器
- 使用Nexus搭建Maven局域网服务器
- Maven学习 (四) 使用Nexus搭建Maven私服 为什么要搭建nexus私服,原因很简单,有些公司都不提供外网给项目组人员,因此就不能使用maven访问远程的仓库地址,所以很有必要在局域网里找
- VMware Workstation 12 Pro Ubuntu操作系统vmware怎么安装windows7,Ubuntu下 SVN 服务器搭建及使用快速构建SVN局域网服务器
- Windows下SVN服务器搭建和subclipse安装使用
- 08(maven+SSH)网上商城项目实战之使用nexus搭建maven私有服务器
- 使用BIND安装智能DNS服务器(一)---基本的主从DNS服务器搭建
- yum的安装的使用搭建简单的apache服务器
- 怎么搭建公司内部Maven服务器
- linux(debian) 下安装ample搭建局域网共享音乐服务器。
- git概述及服务器搭建和客户端安装及使用
- 搭建局域网Maven服务器
- 08(maven+SSH)网上商城项目实战之使用nexus搭建maven私有服务器
- 如何使用局域网中一台机器搭建面向广域网的Web服务器: DMZ主机
- 搭建局域网Maven服务器
- 多仓库代码管理器Repo的安装,使用以及服务器搭建
- 局域网内WSUS服务器的安装与使用经验