nexus2.6.2安装教程
简言:
Nexus是Maven仓库管理器,目的是搭建一个本地仓库服务器,其实就是在公司局域网中设置一个可以供内部下载到maven 数据的服务器,这样的好处是节省网络资源,速度快,可以通过nexus对项目的零时版本管理,来进行模块间的依赖开发,也可以自己发布一些资源来共享。
1.安装
网址:http://www.sonatype.org/nexus/下载
下载后的文件:neus-2.6.2-01-bundle.zip随便解压到一个地方就ok。在{base}/bin/jswx下面有安装和启动nexus的脚步目录,选择对应你系统的目录。我的是windows-x86-64.
这里主要看你的jdk安装的版本,如果jdk安装的是64的那么就选择64位,如果是32就选择32为,应该是这样的。
首先安装右键点击install-nexus.bat管理员运行(记住一定是管理员运行),然后右键点击start-nexus.bat 。
下载验证是否运行正常,浏览器中输入:http://localhost:8081/nexus/,8081是nexus的默认端口号。如果没有运行起来,那么你需要去查看{base}/log目录下的日志信息了。
2.现在来说一下如何使用,来构建自己的局域网数据仓库。
在页面的右上角,有log in 登陆按钮,默认的登陆用户名密码是 admin admin123
数据仓库分为三种:proxy,host,group
central 是 apache的数据仓库,下图是它的设置,修改dowload remote indexes 为true
项目pom.xml中添加:
<!--配置部署的远程仓库-->
<distributionManagement>
<snapshotRepository>
<id>nexus-snapshots</id>
<name>nexus distribution snapshot repository</name>
<url>http://192.168.248.129:8081/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
修改setting.xml:
<servers>
<server>
<id>nexus-snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
<profiles>
<profile>
<id>dev</id>
<repositories>
<repository>
<id>nexus</id>
<url>http://192.168.248.129:8081/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<url>http://192.168.248.129:8081/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>dev</activeProfile>
</activeProfiles>