IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> 系统运维 -> Docker部署nexus -> 正文阅读

[系统运维]Docker部署nexus

Resources:

中心仓库索引,好大的文件。

nexus-2.15.1-02-bundle.tar.gz
openjdk-8u41-b04-linux-x64-14_jan_2020.tar.gz
?

Dockerfile:

FROM centos:centos7

MAINTAINER PCM

ADD openjdk-8u41-b04-linux-x64-14_jan_2020.tar.gz nexus-2.15.1-02-bundle.tar.gz /usr/local/

RUN sed -i 's/#RUN_AS_USER=/RUN_AS_USER=root/' /usr/local/nexus-2.15.1-02/bin/nexus

ENV JAVA_HOME=/usr/local/java-se-8u41-ri/ \
? ? PATH=$PATH:/usr/local/java-se-8u41-ri/bin

EXPOSE 8081

CMD /usr/local/nexus-2.15.1-02/bin/nexus start && tail -f /usr/local/nexus-2.15.1-02/logs/wrapper.log


?

docker run:

docker run --name=nexus -d -p8081:8081 -v /usr/local/sonatype-work/:/usr/local/sonatype-work/ --privileged=true ?549414168/nexus:v1

运行之后覆盖中心仓库索引,之后重启。

一直无法有索引和docker容器内权限有关系,真坑。

总算是配置成功。

相关资料:

nexus2下载:

Downloadhttps://help.sonatype.com/repomanager2/download#Download-NexusRepositoryManager2OSS索引地址:

Central Repository: .index

nexus-maven-repository-index.gz                   2022-07-13 22:041615748068      
nexus-maven-repository-index.gz.md5               2022-07-13 22:04        32      
nexus-maven-repository-index.gz.sha1              2022-07-13 22:04        40      
nexus-maven-repository-index.properties           2022-07-13 22:04      1130      

解压索引工具:indexer-cli-5.1.1.jar

Maven Central Repository Search

wget https://repo.maven.apache.org/maven2/.index/nexus-maven-repository-index.gz
wget https://repo.maven.apache.org/maven2/.index/nexus-maven-repository-index.properties
wget https://repo.maven.apache.org/maven2/org/apache/maven/indexer/indexer-cli/5.1.1/indexer-cli-5.1.1.jar
wget https://repo.maven.apache.org/maven2/.index/nexus-maven-repository-index.gz.md5
wget https://repo.maven.apache.org/maven2/.index/nexus-maven-repository-index.gz.sha1


?

导入本地仓库架包:

1.编脚本mavenimport.sh

#!/bin/bash
?
# copy and run this script to the root of the repository directory containing files
# this script attempts to exclude uploading itself explicitly so the script name is important
# Get command line params
while getopts ":r:u:p:" opt; do
?? ?case $opt in
?? ??? ?r) REPO_URL="$OPTARG"
?? ??? ?;;
?? ??? ?u) USERNAME="$OPTARG"
?? ??? ?;;
?? ??? ?p) PASSWORD="$OPTARG"
?? ??? ?;;
?? ?esac
done
?
find . -type f -not -path './mavenimport\.sh*' -not -path '*/\.*' -not -path '*/\^archetype\-catalog\.xml*' -not -path '*/\^maven\-metadata\-local*\.xml' -not -path '*/\^maven\-metadata\-deployment*\.xml' | sed "s|^\./||" | xargs -I '{}' curl -u "$USERNAME:$PASSWORD" -X PUT -v -T {} ${REPO_URL}/{} ;

文件保存到仓库根路径。

2.启动脚本

./mavenimport.sh -u admin -p admin123 -r http://192.168.2.3:8081/nexus/content/repositories/myrep/

导入后项目测试

1.maven。setting设置

<localRepository>D:\apache-maven-3.6.0\test</localRepository>
    <pluginGroups>
    </pluginGroups>
    <proxies>
    </proxies>
    <servers>
        <server>
            <id>releases</id>
            <username>admin</username>
            <password>admin123</password>
        </server>

        <server>
            <id>snapshots</id>
            <username>admin</username>
            <password>admin123</password>
        </server>
    </servers>

    <profiles>
        <profile>
            <!--profile 的 id-->
            <id>dev</id>
            <repositories>
                <repository>
                    <!--仓库 id,repositories 可以配置多个仓库,保证 id 不重复-->
                    <id>nexus</id>
                    <!--仓库地址,即 nexus 仓库组的地址-->
                    <url>http://192.168.2.3:8081/nexus/content/groups/public/</url>
                    <!--是否下载 releases 构件-->
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <!--是否下载 snapshots 构件-->
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </repository>
            </repositories>
            <pluginRepositories>
                <!-- 插件仓库,maven 的运行依赖插件,也需要从私服下载插件 -->
                <pluginRepository>
                    <!-- 插件仓库的 id 不允许重复,如果重复后边配置会覆盖前边 -->
                    <id>public</id>
                    <name>Public Repositories</name>
                    <url>http://192.168.2.3:8081/nexus/content/groups/public/</url>
                </pluginRepository>
            </pluginRepositories>
        </profile>
    </profiles>
    <activeProfiles>
        <activeProfile>dev</activeProfile>
    </activeProfiles>

2.项目使用pom.xml

<build>
        <plugins>
            ···
            <!--这部分是之前已有,顺便贴上了-->
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <fork>true</fork>
                </configuration>
            </plugin>
            <plugin>
                <!-- skip maven test -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
            <!--这部分是之前已有,顺便贴上了-->
            ······
            <!--这部分是重点,没有发布不到nexus私服仓库-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

    <distributionManagement>
        <repository>
            <id>releases</id>
            <url>http://192.168.2.3:8081/nexus/content/repositories/releases/</url>
        </repository>
        <snapshotRepository>
            <id>snapshots</id>
            <url>http://192.168.2.3:8081/nexus/content/repositories/snapshots/</url>
        </snapshotRepository>
    </distributionManagement>

温馨提示:

此处注意:pom中的这部分新增URL和ID与setting中的对应。

不新增这部分也可以使用。

  系统运维 最新文章
配置小型公司网络WLAN基本业务(AC通过三层
如何在交付运维过程中建立风险底线意识,提
快速传输大文件,怎么通过网络传大文件给对
从游戏服务端角度分析移动同步(状态同步)
MySQL使用MyCat实现分库分表
如何用DWDM射频光纤技术实现200公里外的站点
国内顺畅下载k8s.gcr.io的镜像
自动化测试appium
ctfshow ssrf
Linux操作系统学习之实用指令(Centos7/8均
上一篇文章      下一篇文章      查看所有文章
加:2022-07-20 19:20:33  更:2022-07-20 19:22:48 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年5日历 -2024/5/18 20:53:55-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码