【发布时间】:2016-09-24 10:41:02
【问题描述】:
我正在尝试将 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
已将工件发布到 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
}
}
}
它说任务成功,但工件没有在 Artifactory 中发布。我错过了什么明显的东西吗?我该如何解决?
【问题讨论】:
标签: android maven android-gradle-plugin android-library artifactory