engineering-management
  • Introduction
  • Git源码管理
    • Git简介及使用场景
    • Windows安装Git
    • Linux安装Git
    • Git命令详解
      • git基本操作命令
      • git远程仓库命令
      • git撤销操作命令
      • git删除本地仓库中所有的.git文件夹
      • git版本回滚命令
      • git分支管理
      • git如何拉取指定分支(远程仓库)代码
      • git合并冲突命令
    • 构建私有仓库
    • 如何利用github/码云进行学习
      • github
      • 码云
    • 详解Git-flow企业级开发流程
  • Maven
    • 概念剖析
    • maven build标签(打入外部jar包、xml配置编译)
    • maven 发布github的release版本
    • maven安装和配置
    • maven命令详解
    • maven仓库
    • 开发常见问题汇总
    • 构建企业级私有仓库Nexus
      • Linux安装Nexus
      • Windows 安装Nexus
    • 大型系统模块化工程管理实践/maven构建多模块项目
    • maven导出项目依赖的jar包
    • maven普通项目转成web项目
    • maven命令创建web项目
    • maven settings配置详解
    • maven scm 用法(SVN 的独有配置)
    • maven修改后的settings.xml文件
    • maven集成Tomcat插件
    • maven集成Tomcat插件(二)
    • maven+tomcat6-maven-plugin 实现热部署及调试
    • maven项目将自研发的依赖包打进Jar文件中
    • maven自定义插件研发
    • maven部署到Tomcat的对应目录如下
    • maven中的MANIFEST.MF文件中的Class-Path中增加当前目录(.)
    • maven如何修改本地仓库与中央仓库
    • maven的<profile>标签,打包不同配置的变量包
    • maven 在idea中依赖包不自动更新问题
  • Sonar代码质量检测平台
    • 常见代码检查工具及规范(PMD、checkStyle)
      • CheckStyle插件安装和使用
    • 构建Sonar环境
    • Sonar+Maven集成代码质量检测工具
    • Sonar代码质量检测报告解析
    • 代码常见质量问题分析
  • Jenkins持续集成
    • DevOps持续集成介绍
    • Jenkins环境构建
      • Jenkins的war包安装
      • Windows安装Jenkins.exe
      • Jenkins关闭和重启
    • Jenkins集成git/svn/tomcat/sonar等
      • Jenkins Tomcat安装设置
      • Jenkins Git安装设置
      • Jenkins Maven安装设置
    • Jenkins插件机制
    • Jenkins自动构建部署maven项目的WEB项目
    • Jenkins部署远程服务器(jenkins+svn+maven)
Powered by GitBook
On this page
  • Linux安装Nexus
  • 一、搭建nexus服务的意义
  • 二、安装nexus
  • 三、配置nexus
  • 四、启动nexus
  • 五、管理nexus
  • 1. 默认的用户:
  • 2. 修改用户信息
  • 六、在项目中使用nexus
  • 1. 作为插件库
  • 2. 作为deploy库

Was this helpful?

  1. Maven
  2. 构建企业级私有仓库Nexus

Linux安装Nexus

Linux安装Nexus

一、搭建nexus服务的意义

  1. 作为内网的统一代理,团队合作开发时不用每人都去外网下载一次;

  2. 解决部分变态公司内网管制无法访问外网的问题,选一台有外网权限的机器搭建服务器,其余人直接内网访问此服务;

  3. 团队合作开发时解决maven项目依赖问题;

二、安装nexus

# 下载安装包:
wget https://sonatype-download.global.ssl.fastly.net/nexus/oss/nexus-2.14.4-03-bundle.tar.gz

# 解压
mkdir /data/apps
cd /data/apps
tar -zxvf ~/nexus-2.14.4-03-bundle.tar.gz

三、配置nexus

编辑配置文件:vim conf/nexus.properties

# Jetty section
application-port=8081      # 访问端口
application-host=0.0.0.0   # 绑定IP
nexus-webapp=${bundleBasedir}/nexus   # 指定nexus程序目录
nexus-webapp-context-path=/nexus      # 指定访问的二组目录

# Nexus section
nexus-work=${bundleBasedir}/../sonatype-work/nexus
runtime=${bundleBasedir}/nexus/WEB-INF

四、启动nexus

启动脚本:bin/nexus

# 启动脚本有如下参数可选
[root@ci-gitlab nexus-2.14.4-03]# bin/nexus
Usage: ./nexus { console | start | stop | restart | status | dump }

注意:nexus采用wrapper做为WEB容器,nexus只是shell脚本,最终会调用jsw目录下对应平台中的wrapper二进制文件

五、管理nexus

1. 默认的用户:

admin/admin123 deployment/deployment123

2. 修改用户信息

admin登陆后,点击左侧【Security–Users】,在列表中选择用户,右键可更改密码和重围密码, 底部表格中可修改用户其余信息

六、在项目中使用nexus

1. 作为插件库

点击左侧【Views/Repositories–Repositories】,选择【Public Repositories】,复制其Repository Path字段 编辑pom.xml文件,添加如下段:

<!-- 设定主仓库,按设定顺序进行查找。 -->
<!-- 设定主仓库,按设定顺序进行查找。 -->
    <repositories>
        <repository>
            <id>releases</id>
            <name>Team Nexus Repository</name>
            <url>${Repository Path}</url>
        </repository>

        <repository>
            <id>snapshots</id>
            <name>Team Nexus Repository</name>
            <url>${Repository Path}</url>
        </repository>
    </repositories>

2. 作为deploy库

点击左侧【Views/Repositories–Repositories】,选择【 Release 或 Snapshots】,复制其Repository Path字段 编辑pom.xml文件,添加如下段:

<!-- 设定发布位置,mvn deploy时用到,不设置时会报错-->
    <distributionManagement>
        <repository>
            <id>ci-releases</id>
            <name>Gigold Nexus Repository</name>
            <url>http://ci-gitlab:8081/content/repositories/releases</url>
        </repository>
        <snapshotRepository>
            <id>ci-snapshots</id>
            <name>Gigold Nexus Repository</name>
            <url>http://ci-gitlab:8081/content/repositories/snapshots/</url>
        </snapshotRepository>
    </distributionManagement>

注意:不设置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]
Previous构建企业级私有仓库NexusNextWindows 安装Nexus

Last updated 5 years ago

Was this helpful?

以上都是默认配置,对应的访问地址为:

如果要改为,则修改nexus-webapp-context-path=/即可

http://x.x.x.x:8081/nexus
http://x.x.x.x:8081