linux下批量上传本地jar到nexus私服上

1,将本地repository资源上传到linux服务下,

可以用sftp命令在windows下链接linux服务器

用put命令将windows下的资源上传到linux下

2,解压linux下的repository.zip文件

unzip repository.zip

linux下批量上传本地jar到nexus私服上_第1张图片

3,在repository.zip解压的文件 repository下面,创建导入脚本文件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}/{} ;

保存退出,修改权限

chomd 777 mavenimport.sh

4,执行导入命令

./mavenimport.sh -u admin -p admin -r http://localhost:8081/repository/maven-releases/

 

看到界面滚动显示如下:linux下批量上传本地jar到nexus私服上_第2张图片

查看nexus服务器

linux下批量上传本地jar到nexus私服上_第3张图片

并搜索相关 spring-core.jar

linux下批量上传本地jar到nexus私服上_第4张图片

linux下批量上传本地jar到nexus私服上_第5张图片

能看到jar在nexus服务器里面存储的二进制文件目录:default@7AB5C84A-42EADAB4-12BD8015-88EE4D3E-E38D31D1:bb08b74c-1432-40e3-a09c-7c7dcd45b6e0

linux下批量上传本地jar到nexus私服上_第6张图片

 

 

你可能感兴趣的:(java,nexus)