云容器(二)、使用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}/{} ;
相关推荐
Aurorar0rua11 小时前
CS50 x 2024 Notes C - 06
开发语言·学习方法
xyq202411 小时前
SQLite Like 子句详解
开发语言
Highcharts.js11 小时前
线形比赛积分增长或竞赛图|Highcharts企业图表代码示列
开发语言·前端·javascript·折线图·highcharts·竞赛图
古城小栈11 小时前
rust 亿级并发模型,实践完成
开发语言·网络·rust
Codigger官方11 小时前
Phoenix 语言起步指南:开启 Polyglot Singularity 之门
开发语言·人工智能·程序人生
让学习成为一种生活方式11 小时前
大肠杆菌合成扑热息痛--对乙酰氨基酚--文献精读227
开发语言·前端·javascript
yuzhiboyouye11 小时前
为什么sping-boot+ mabatis。写接口时要建好几个VO。各自用途时
java
啧不应该啊11 小时前
Day1 C与python输入输出语句区别
c语言·开发语言
SamDeepThinking11 小时前
第2篇:应付百万并发商品系统之需求文档
java·后端·架构
heimeiyingwang11 小时前
【架构实战】领域事件与业务编排架构
java·微服务·架构