インポートローカルのMavenリポジトリのインポートnexus3(スクリプト)

例のファイル構造を次のように

[root@localhost shanhy]# tree -C
.
└── myrepo
    ├── mavenimport.sh
    ├── com
    │   └── oracle
    │       └── ojdbc6
    │           └── 11.2.0.4.0
    │               ├── m2e-lastUpdated.properties
    │               ├── ojdbc6-11.2.0.4.0.jar
    │               ├── ojdbc6-11.2.0.4.0.jar.sha1
    │               ├── ojdbc6-11.2.0.4.0-javadoc.jar.lastUpdated
    │               ├── ojdbc6-11.2.0.4.0.pom
    │               ├── ojdbc6-11.2.0.4.0.pom.sha1
    │               ├── ojdbc6-11.2.0.4.0-sources.jar.lastUpdated
    │               └── _remote.repositories
    └── xpp3
        └── xpp3
            └── 1.1.4c
                ├── m2e-lastUpdated.properties
                ├── _maven.repositories
                ├── xpp3-1.1.4c.jar
                ├── xpp3-1.1.4c.jar.sha1
                ├── xpp3-1.1.4c.pom
                ├── xpp3-1.1.4c.pom.sha1
                ├── xpp3-1.1.4c-sources.jar
                └── xpp3-1.1.4c-sources.jar.sha1

8 directories, 17 files
[root@localhost shanhy]# 

これは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}/{} ;

スクリプトを実行するコマンドの例:

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

(終わり)

公開された378元の記事 ウォンの賞賛1419 ビュー632万+

おすすめ

転載: blog.csdn.net/catoop/article/details/104304512