一、搭建服务的意义
作为内网的统一代理,团队合作开发时不用每人都去外网下载一次;
解决部分变态公司内网管制无法访问外网的问题,选一台有外网权限的机器搭建服务器,其余人直接内网访问此服务;
团队合作开发时解决maven项目依赖问题;
二、安装nexus
三、配置nexus
编辑配置文件:vim conf/nexus.properties
以上都是默认配置,对应的访问地址为: http://x.x.x.x:8081/nexus
如果要改为http://x.x.x.x:8081,则修改nexus-webapp-context-path=/即可
四、启动nexus
启动脚本:bin/nexus
注意:nexus采用wrapper做为WEB容器,nexus只是shell脚本,最终会调用jsw目录下对应平台中的wrapper二进制文件
五、管理nexus
1. 默认的用户:
2. 修改用户信息
admin登陆后,点击左侧【Security–Users】,在列表中选择用户,右键可更改密码和重围密码, 底部表格中可修改用户其余信息
六、在项目中使用nexus
1. 作为插件库
点击左侧【Views/Repositories–Repositories】,选择【Public Repositories】,复制其Repository Path字段
编辑pom.xml文件,添加如下段:
2. 作为deploy库
点击左侧【Views/Repositories–Repositories】,选择【 Release 或 Snapshots】,复制其Repository Path字段
编辑pom.xml文件,添加如下段:
注意:不设置distributionManagement段,执行mvn deploy会报如下错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project helloworld-a: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [Help 1]
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持服务器之家。
原文链接:https://blog.csdn.net/yu12377/article/details/73345046