如何使用 REST API 部署具有 Maven 布局的工件?

Mir*_*hdi 3 artifactory

我可以使用以下命令进行正常部署

curl -i -X PUT -u $artifactoryUser:$artifactoryPassword -T /path/to/file/file.zip http://localhost/artifactory/simple/repo/groupId/artifactId/version/file.zip
Run Code Online (Sandbox Code Playgroud)

但是,这不会解析或更新工件上的 Maven 布局。有没有一种方法可以在不使用artifactory-maven 插件的情况下上传?

Mir*_*hdi 5

我找到了我发布的这个问题的解决方案。

使用的语法:

curl -i -X PUT -K $CURLPWD "http://localhost/artifactory/$REPO/$groupId/$artifactId/$versionId/$artifactId-$versionId.$fileExt"
Run Code Online (Sandbox Code Playgroud)

最终编写了一个脚本,以便将 md5 和 sha1 值与文件一起上传,否则,我必须进入 Artifactory 并手动修复它。

#!/bin/bash

usage() {
        echo "Please check the Usage of the Script, there were no enough parameters supplied."
        echo "Usage: ArtifactoryUpload.sh localFilePath Repo GroupID ArtifactID VersionID"
        exit 1
}

if [ -z "$5" ]; then
        usage
fi

localFilePath="$1"
REPO="$2"
groupId="$3"
artifactId="$4"
versionId="$5"

ARTIFAC=http://localhost/artifactory

if [ ! -f "$localFilePath" ]; then
        echo "ERROR: local file $localFilePath does not exists!"
        exit 1
fi

which md5sum || exit $?
which sha1sum || exit $?

md5Value="`md5sum "$localFilePath"`"
md5Value="${md5Value:0:32}"

sha1Value="`sha1sum "$localFilePath"`"
sha1Value="${sha1Value:0:40}"

fileName="`basename "$localFilePath"`"
fileExt="${fileName##*.}"

echo $md5Value $sha1Value $localFilePath
echo "INFO: Uploading $localFilePath to $targetFolder/$fileName"

curl -i -X PUT -K $CURLPWD \
-H "X-Checksum-Md5: $md5Value" \
-H "X-Checksum-Sha1: $sha1Value" \
-T "$localFilePath" \
"$ARTIFAC/$REPO/$groupId/$artifactId/$versionId/$artifactId-$versionId.$fileExt"
Run Code Online (Sandbox Code Playgroud)