2014-11-24 44 views
1

我可以使用下面的命令如何使用REST API使用Maven佈局部署工件?

curl -i -X PUT -u $artifactoryUser:$artifactoryPassword -T /path/to/file/file.zip http://localhost/artifactory/simple/repo/groupId/artifactId/version/file.zip 

不過,這不會解決或神器更新Maven的佈局做了正常的部署。有沒有一種方法可以在不使用artifactory-maven插件的情況下上傳?

+0

你說的「不解決或更新的maven佈局」是什麼意思? – 2014-11-24 15:07:35

+0

這不是爲Maven或任何其他構建工具創建「依賴聲明」。我也更新了這個問題。 – 2014-11-24 23:04:37

+0

你的意思是你沒有看到UI中的代碼片段? 你可以發表一個截圖嗎? – JBaruch 2014-11-25 12:17:36

回答

1

我找到了我發佈的這個問題的解決方案。

語法中使用:

curl -i -X PUT -K $CURLPWD "http://localhost/artifactory/$REPO/$groupId/$artifactId/$versionId/$artifactId-$versionId.$fileExt" 

最後寫一個腳本,以便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"