60-010-020- use -Nexus3 bulk upload jar package

1. Mito

Here Insert Picture Description# 2. General
because I want to upload all of the warehouse pack, hoping nexus in the existing package, I do not cover, not added. I would like to bulk upload jar.

3. Scheme 1 - Bulk upload script

PS: nexus3.x version can only upload script

[Picture dump outside the chain fails, the source station may have a security chain mechanism, it is recommended to save the pictures uploaded directly down (img-e204HRFp-1585563810499) (00-nexus-image / image-20200330151629404.png)]

3.1 Batch into the jar

  • In mac directory, create a new folder repo, we need to put the bulk of the local library folder, and the folder Authorization
(base) lcc@lcc nexus-3.22.0-02$ mkdir repo2
(base) lcc@lcc nexus-3.22.0-02$ chmod -R 777 repo2

Create a script

(base) lcc@lcc nexus-3.22.0-02$ vi  maven_local_to_nexus.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}/{} ;


Given the script executable permission to establish link

./maven_local_to_nexus.sh  -u admin -p 123456 -r http://localhost:8081/repository/maven-lcc

But after such a default is uploaded into the whole system under the.

After the execution effect

< HTTP/1.1 201 Created
< Date: Mon, 30 Mar 2020 07:24:03 GMT
< Server: Nexus/3.22.0-02 (OSS)
< X-Content-Type-Options: nosniff
< Content-Security-Policy: sandbox allow-forms allow-modals allow-popups allow-presentation allow-scripts allow-top-navigation
< X-XSS-Protection: 1; mode=block
< Content-Length: 0
<
* Connection #0 to host localhost left intact
*   Trying ::1:8081...
* TCP_NODELAY set
* Connection failed
* connect to ::1 port 8081 failed: Connection refused
*   Trying 127.0.0.1:8081...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 8081 (#0)
* Server auth using Basic with user 'admin'
> PUT /repository/maven-lcc/snapshots/system/org/sonatype/nexus/nexus-oss-edition/3.22.0-02/nexus-oss-edition-3.22.0-02-features.xml HTTP/1.1
> Host: localhost:8081
> Authorization: Basic YWRtaW46MTIzNDU2
> User-Agent: curl/7.68.0
> Accept: */*
> Content-Length: 469
> Expect: 100-continue
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 100 Continue
* We are completely uploaded and fine

Interface shown

Here Insert Picture Description

4. Scheme 2 - direct copy (nexus 2)

The local warehouse jar package copied to the PW central (my path is D: \ nexus \ nexus-2.14.8-01-bundle \ sonatype-work \ nexus \ storage \ central), the

Here Insert Picture Description
then更新索引,不更新索引无效

Here Insert Picture Description

Reference: https: //blog.csdn.net/libusi001/article/details/99593832

Released 1156 original articles · won praise 454 · Views 1.45 million +

Guess you like

Origin blog.csdn.net/qq_21383435/article/details/105205403
Recommended