云容器(二)、使用nexus搭建maven包依赖仓库

1、nexus安装;

使用docker-compose进行安装;

参考:Docker安装Nexus3私服以及使用-腾讯云开发者社区-腾讯云 (tencent.com)

文件docker_nexus.yml,内容如下

version: "3.3"
services:
  nexus:
    image: sonatype/nexus3
    container_name: nexus3
    restart: always
    environment:
      - TZ=Asia/Shanghai
    ports:
      - 7071:8081
    volumes:
      - K:\docker_data\nexus\data:/nexus-data
    networks:
      - mynet
      
# 统一管理网桥
networks:
  mynet:
    driver: bridge

构建命令:

docker-compose -f docker_nexus.yml up -d

访问地址:http://localhost:7071/#browse

2、本地的依赖包上传:

将文件mvnimport.sh放置在本地jar包目录下(注意要放置位置在所有jar包的父节点)

使用gitbash执行上传命令:

./mvnimport.sh -u admin -p admin -r http://192.168.30.168:7071/repository/maven-public/

mvnimport.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 './mvnimport\.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}/{} ;
相关推荐
xwlcfyb几秒前
零基础学好C语言系列第八讲:初识指针
c语言·开发语言
非 白2 分钟前
【Java分布式】Nacos注册中心
java·开发语言·nacos·注册中心
88号技师3 分钟前
2025年2月最新SCI-鹰鱼优化算法HawkFish Optimization Algorithm-附Matlab免费代码
开发语言·算法·matlab·优化算法
吃海鲜的骆驼8 分钟前
服务异步通讯与RabbitMQ
java·分布式·后端·rabbitmq
羱滒11 分钟前
sql调优之数据库开发规范
java·数据库·数据库开发
Forget the Dream40 分钟前
设计模式之责任链模式
java·c++·设计模式·责任链模式
jonyleek43 分钟前
「JVS更新日志」低代码、企业会议、智能BI、智能排产2.26更新说明
java·大数据·低代码·数据分析·软件需求
Joey_friends43 分钟前
【Linux】线程详解
开发语言
_GR1 小时前
Qt开发⑧Qt的窗口_下_浮动窗口+对话框
开发语言·css·c++·qt·microsoft
Good Note1 小时前
Golang——常用库context和runtime
开发语言·爬虫·golang