Nexus 的Docker 安装及配置说明

Nexus 介绍

Nexus是一个开源的组件库管理工具,其分为Nexus?OSS?免费版本和Pro商业版本。其目前支持?Maven/Java,?npm,?NuGet,?Helm,?Docker,?P2,?OBR,?APT,?GO,?R,?Conan?等流行组件的管理和仓库代理。其可以为开发人员提供从源代代码到二进制、容器及打包集成等的组件管理工作。即支持包括Gradle,?Ant,?Maven和Ivy的JVM生态环境,同时也可以和Eclipse,?IntelliJ,?Hudson,?Jenkins,?Puppet,?Chef,?Docker等流行工具有效集成。
Nexus 的Docker 安装及配置说明

Nexus 部署

环境说明

Nexus?安装

mkdir?-p?/opt/data/apps/nexus/nexus-data?&&?chown?-R?200?/opt/data/apps/nexus/nexus-data
docker?run?--name?nexus3?-h?nexus?-d?-p?8081:8081?-v?/opt/data/apps/nexus/nexus-data:/nexus-data?-it?sonatype/nexus3

Nexus?关键词

Role

  • 创建role?name:nx-developer
    ????角色权限如下:??
    ????<br/>????nx-repository-view-*-*-edit<br/>????nx-repository-view-*-*-read<br/>????
  • 创建用户:developer?配置密码?11111111,?
    ????分配角色?nx-developer

Policy(策略)分类

仓库名称 说明
maven-central maven*库,默认从https://repo1.maven.org/maven2/?拉取jar
maven-releases 私库发行版jar,初次安装请将Deployment?policy设置为Allow?redeploy
maven-snapshots 私库快照(调试版本)jar
maven-public 仓库分组,把上面三个仓库组合在一起对外提供服务,在本地maven基础配置settings.xml中使用。

类型

名称 说明
group(仓库组类型) 又叫组仓库,用于方便开发人员自己设定的仓库;
hosted(宿主类型) 内部项目的发布仓库(内部开发人员,发布上去存放的仓库);
proxy(代理类型) 从远程*仓库中寻找数据的仓库(可以点击对应的仓库的Configuration页签下Remote?Storage?其属性的值即被代理的远程仓库的路径);
virtual(虚拟类型) 虚拟仓库(这个基本用不到,重点关注上面三个仓库的使用);

调度任务

Execute?script:执行自定义脚本
Purge开头:清理一些不使用的资源。
Rebuild?repository?index:为仓库重新编纂索引,从远仓库下载最新的索引。
Rebuild?Maven?repository?metadata:基于仓库内容重新创建仓库元数据文件,同时重新创建每个文件的校验和md5与sha1。
Remove?snapshots?from?Maven?repository:把快照删了,这个是在稳定版发布后清除

存储?Blob?Stores

对应文件系统的一个目录,可供仓库上传文件使用

组件集成

maven?配置

<?xml?version="1.0"?encoding="UTF-8"?>
<settings?xmlns="http://maven.apache.org/SETTINGS/1.2.0"
??????????xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
??????????xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0?http://maven.apache.org/xsd/settings-1.2.0.xsd">,
??<proxies>
??<pluginGroups>
??</pluginGroups>
??</proxies>
??<servers>
????<server>
??????<id>snapshots</id>
??????<username>developer</username>
??????<password>11111111</password>
????</server>
??</servers>
??<mirrors>
????<mirror>
??????<id>nexus</id>
??????<mirrorOf>*</mirrorOf>
??????<url>http://172.17.10.4:8081/repository/maven-public/</url>
????</mirror>
??</mirrors>
??<profiles>
????<profile>??
??????<id>development</id>
??????<repositories>
????????<repository>
??????????<id>Nexus</id>
??????????<url>http://172.17.10.4:8081/repository/maven-public/</url>
??????????<releases>
????????????<enabled>true</enabled>
??????????</releases>
??????????<snapshots>
????????????<enabled>true</enabled>
????????????<updatePolicy>always</updatePolicy>
??????????</snapshots>
????????</repository>
??????</repositories>
??????<activation>
????????<activeByDefault>true</activeByDefault>??????
????????<jdk>1.8</jdk>
??????</activation>
??????<properties>
????????<maven.compiler.source>1.8</maven.compiler.source>
????????<maven.compiler.target>1.8</maven.compiler.target>
????????<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
??????</properties>
????</profile>
??</profiles>
??<activeProfiles>
??????<activeProfile>development</activeProfile>
??</activeProfiles>
</settings>

pom?修改上传

<distributionManagement>
??<repository>
????<id>releases</id>
????<name>Releases</name>
????<url>http://172.17.10.4:8081/repository/maven-releases/</url>
??</repository>
??<snapshotRepository>
????<id>snapshots</id>
????<name>Snapshot</name>
????<url>http://172.17.10.4:8081/repository/maven-snapshots/</url>
??</snapshotRepository>
</distributionManagement>
上一篇:qwb2021 pwn复现


下一篇:str.trim is not a function