云容器(二)、使用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}/{} ;

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值