2014-11-24 97 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"