【发布时间】:2023-02-18 02:40:58
【问题描述】:
我正在尝试在 Azure Blob 存储上设置工件存储库。我想将通过 gradle build 生成的工件发布到此 repo,然后将此工件用作其他 gradle 项目的依赖项。
有什么想法吗?
【问题讨论】:
标签: gradle azure-devops
我正在尝试在 Azure Blob 存储上设置工件存储库。我想将通过 gradle build 生成的工件发布到此 repo,然后将此工件用作其他 gradle 项目的依赖项。
有什么想法吗?
【问题讨论】:
标签: gradle azure-devops
您可以使用 Azure File Copy task 将您的 artifatc 复制到 Microsoft Azure 存储 blob。然后,你可以 Download blobs from Azure Blob Storage by using AzCopy 作为依赖。
【讨论】:
此响应可能会延迟,但我遇到了类似的问题并且能够通过使用 SFTP 将工件发布到 blob 容器来解决它。为此,您需要执行以下步骤:
在您的 build.gradle 文件中,设置 Maven 发布插件以声明您要使用 SFTP 发布到的 Maven 存储库。 提供您的 SFTP 凭据以验证和授权发布操作。 通过执行这些步骤,您应该能够成功地将工件发布到 blob 容器。
publishing {
publications {
maven(MavenPublication) {
groupId '<com. ... group here>'
artifactId '<artifactId here>'
version '1.0.0.0'
artifact 'build/outputs/aar/...-release.aar'
}
}
repositories {
maven {
url 'sftp://<workspace name here>.blob.core.windows.net:22'
credentials {
username "<username here>"
password "<password here>"
}
}
}
}
阅读您在 settings.gradle 中声明的已发布工件
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
// Using Blob Storage
maven {
url "https://<workspace name here>.blob.core.windows.net/<container name here>/"
credentials {
username "<username here>"
password "<password here>"
}
}
jcenter() // Warning: this repository is going to shut down soon
}
}
在您的依赖项中,您现在可以使用您的工件
dependencies {
// Add Dependency
implementation(group: '<com. ... group here>', name: '<artifactId here>', version: '1.0.0.0')
// Other dependencies goes here
}
希望这可以帮到你。
【讨论】: