【问题标题】:Archiva file upload by Powershell使用 Powershell 上传 Archiva 文件
【发布时间】:2014-06-12 09:28:34
【问题描述】:

我需要创建一个 PowerShell 脚本来将文件上传到 Archiva 存储库

我通过这个示例成功地做到了这一点:

$user = "user"
$pass = "password"
$secpass = ConvertTo-SecureString $pass -AsPlainText -Force
$uri = "http:*//X.X.X.X:8080/repository/win/test/test/1.6/test.exe"
$filePath = "x:\x\test.exe"
$cred = New-Object System.Management.Automation.PSCredential ($user, $secpass)
Invoke-RestMethod -Credential $cred -Uri $uri -Method Put -InFile $filePath -ContentType "multipart/form-data"

但它不能创建或更正一个 maven-metadata.xml 并且需要版本控制。我希望它像通过 Archiva UI 上传一样工作。
所以也许有人可以帮助我使用 PowerShell 的 Archiva rest API 上传脚本。
我需要通过 API 使用此服务

/archivaUiServices/fileUploadService  
/fileUploadService/save/{repositoryId}/{groupId}/{artifactId}/{version}/{packaging}

,但不知道在 Powershell 中使用它们的正确方法
(设法通过复制 fiddler 中捕获的请求来重现上传)

【问题讨论】:

    标签: powershell file-upload archiva


    【解决方案1】:

    不会像它那样工作。 您需要将您的 jar 放入(http 方法)到 maven 路径。

    http://yourinstantce/{repositoryId}/{groupId}/{artifactId}/{version}
    

    【讨论】:

    • 但是如果我使用 PUT 方法,它正在索引文件的版本,我需要那个时刻完成。
    • "isn't" 抱歉打错了
    • 肯定会的!!
    猜你喜欢
    • 1970-01-01
    • 2019-05-20
    • 1970-01-01
    • 2017-11-16
    • 2016-12-08
    • 2010-12-24
    • 2017-02-11
    • 1970-01-01
    相关资源
    最近更新 更多