云容器(二)、使用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}/{} ;
相关推荐
爱笑的眼睛117 分钟前
PyTorch Lightning:重新定义深度学习工程实践
java·人工智能·python·ai
Kevinyu_20 分钟前
责任链模式
java·hadoop·责任链模式
明洞日记23 分钟前
【设计模式手册012】责任链模式 - 请求处理的流水线艺术
java·设计模式·责任链模式
q***071428 分钟前
Java实战:Spring Boot application.yml配置文件详解
java·网络·spring boot
雨中飘荡的记忆38 分钟前
Spring Alibaba AI 实战指南
java·ai编程
冰封剑心40 分钟前
MiniCPM-V-2_6 (4-bit 量化)使用
java·前端·数据库
mqiqe42 分钟前
【Spring AI MCP】四、MCP 服务端
java·人工智能·spring
l***74941 小时前
springboot与springcloud对应版本
java·spring boot·spring cloud
纵有疾風起1 小时前
C++——多态
开发语言·c++·经验分享·面试·开源
稚辉君.MCA_P8_Java1 小时前
Gemini永久会员 Java实现的暴力递归版本
java·数据结构·算法