@JBaruch が既に述べたように、それを行うツールがないため、これを行うスクリプトを作成する必要がありました。スクリプトは非常に不安定で、遅く、保守が難しい場合があるため、注意して使用してください。また、スクリプトは非常に基本的なものであり、後で手動で修正する必要がある場合があることに注意してください。
# run inside of your nexus repo directory, like /opt/nexus/sonatype_work/my_maven_repository
BINTRAY_USER=""
BINTRAY_TOKEN=""
BINTRAY_API="https://api.bintray.com"
BINTRAY_REPO="your_org/maven"
for META_FILE in `find . -type f -name 'maven-metadata.xml' ! -path "*/.nexus/*" ! -path "*/.meta/*" ! -path "*/.index/*"`;
do
echo "Meta-file: $META_FILE"
PRODUCT_DIR=`dirname ${META_FILE#./}`
PRODUCT_ID=`basename $PRODUCT_DIR`
PACKAGE_DIR=`dirname $PRODUCT_DIR`
PACKAGE=`echo $PACKAGE_DIR | tr '/' '.'`
echo "Found product $PRODUCT_ID in $PACKAGE at path $PRODUCT_DIR"
# make project on bintray
PROJECT_ID="$PACKAGE:$PRODUCT_ID"
PROJ_TMPL='{
"name": "%s",
"desc": "%s",
"licenses": ["Apache-2.0"],
"vcs_url": "https://github.com/your_org/",
"public_download_numbers": false,
"public_stats": true
}'
PROJ_DEF=`printf "$PROJ_TMPL" $PROJECT_ID $PACKAGE.$PRODUCT_ID`
PROJ_URL="$BINTRAY_API/packages/$BINTRAY_REPO"
echo "Posting $PROJ_DEF to $PROJ_URL"
curl -H "Content-Type: application/json" -d "$PROJ_DEF" -u$BINTRAY_USER:$BINTRAY_TOKEN $PROJ_URL
echo ""
for VERSION_DIR in `find $PRODUCT_DIR/* -maxdepth 1 -type d ! -name . ! -name .. ! -name '.meta' ! -name '.index' ! -name '.nexus'`;
do
VERSION=`basename $VERSION_DIR`
echo "Found version $VERSION of product $PACKAGE.$PRODUCT_ID"
# make version on bintray
VERSION_TMPL='{
"name": "%s",
"desc": "%s"
}'
VERSION_DEF=`printf "$VERSION_TMPL" $VERSION "$VERSION release of $PACKAGE:$PRODUCT_ID"`
VERSION_URL="$BINTRAY_API/packages/$BINTRAY_REPO/$PROJECT_ID/versions"
echo "Posting $VERSION_DEF to $VERSION_URL"
curl -H "Content-Type: application/json" -d "$VERSION_DEF" -u$BINTRAY_USER:$BINTRAY_TOKEN $VERSION_URL
echo ""
for FILE in `find $VERSION_DIR -type f`;
do
URI="$BINTRAY_API/content/$BINTRAY_REPO/$PROJECT_ID/$VERSION/$FILE;publish=1"
echo "Uploading file $FILE to $URI"
curl -T $FILE -u$BINTRAY_USER:$BINTRAY_TOKEN $URI
echo ""
done
done
done
echo "+--------------------------------+"
echo "| Migration script finished! \o/ |"
echo "+================================+"