gpt4 book ai didi

android - 包括在生成的 android 库的 pom 中的依赖项

转载 作者:行者123 更新时间:2023-12-01 03:32:19 25 4
gpt4 key购买 nike

我正在尝试将 Android 库发布到本地 JFrog Artifactory。目前我有这个:

apply plugin: 'com.jfrog.artifactory'
apply plugin: 'maven-publish'
apply plugin: 'com.android.library'

publishing {
publications {
aar(MavenPublication) {
groupId libraryGroupId
version libraryVersion
artifactId libraryArtifactId

artifact("$buildDir/outputs/aar/app-beta-debug.aar")
}
}
}

artifactory {
contextUrl = 'http://localhost:8081/artifactory'
publish {
repository {
repoKey = 'libs-release-local'

username = artifactory_username
password = artifactory_password
}
defaults {
publications('aar')
publishArtifacts = true

properties = ['qa.level': 'basic', 'q.os': 'android', 'dev.team': 'core']
publishPom = true
}
}
}

为简洁起见,我跳过了一些部分,如 android 和依赖项部分。 build.gradle 有多个编译依赖项。
gradle artifactoryPublish

将 Artifact 发布到 Artifactory 但生成的 pom 没有依赖项。我找到了这个答案: https://stackoverflow.com/a/30523571/2829308

从这个答案, pom.withXml工作(虽然我不知道如何排除依赖)。但这似乎很骇人听闻。我觉得应该有更好的方法可用。我尝试使用 uploadArchives方式如下
uploadArchives {
repositories {
mavenDeployer {
repository(url: "http://localhost:8081/artifactory/libs-release-local")
pom.version = libraryVersion
pom.artifactId = libraryArtifactId
pom.groupId = libraryGroupId
}
}
}

它说任务成功,但 Artifact 没有在 Artifactory 中发布。我错过了一些明显的东西吗?我该如何解决?

最佳答案

Pom 文件不应包含传递依赖项,而应包含直接依赖项。 Maven 解析 pom 文件以找到直接依赖项,下载它们并以递归方式从那里继续。

您应该在 pom 文件中看到的唯一依赖项是在 dependences 中声明的那些。你的 gradle 脚本 block 。

关于android - 包括在生成的 android 库的 pom 中的依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37460638/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com