Maven jar上传Nexus教程

上传jar教程

1. 找到对应的仓库上传路径

release和snapshot版本的路径,没有则创建

稳定版本:http://ip:port/repository/maven-release

快照版本:http://ip:port/repository/maven-snapshot

image

 

2.切换到repository仓库目录下执行命令

上传快照:

mavenimport.sh -u 账号 -p 密码 -r http://ip:port/repository/maven-snapshot/

上传稳定版本:

mavenimport.sh -u 账号 -p 密码 -r http://ip:port/repository/maven-release/

image

 

image

 

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}{} ;

 

posted @ 2025-08-12 09:33  咔咔皮卡丘  阅读(49)  评论(0)    收藏  举报