我使用Bamboo 6.0.3 build 60004
,我安裝了official Artifactory plugin for Bamboo的版本2.1.0
。從Bamboo發佈到Artifactory 6
該項目的build.gradle
樣子:
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.artifactory'
...
task androidJavadocs(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}
task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
classifier = 'javadoc'
from androidJavadocs.destinationDir
}
task androidSourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
}
artifacts {
archives androidSourcesJar
archives androidJavadocsJar
}
afterEvaluate {
androidJavadocs.classpath += files(android.libraryVariants.collect { variant ->
variant.javaCompile.classpath.files
})
}
publishing {
publications {
android.buildTypes.all { variant ->
"${variant.name}Aar"(MavenPublication) {
// set values from Android manifest file
groupId group
version version
if (variant.name == "release") {
artifactId project.getName()
}
else {
artifactId "${project.getName()}-${variant.name}"
}
artifact "$buildDir/outputs/aar/${project.getName()}-${variant.name}-${version}.aar"
artifact androidJavadocsJar
pom.withXml {
def dependenciesNode = asNode().appendNode('dependencies')
// List all compile dependencies and write to POM
configurations.compile.getAllDependencies().each { Dependency dep ->
if (dep.group == null || dep.version == null || dep.name == null || dep.name == "unspecified")
return // ignore invalid dependencies
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', dep.group)
dependencyNode.appendNode('artifactId', dep.name)
dependencyNode.appendNode('version', dep.version)
if (!dep.transitive) {
// If this dependency is transitive, we should force exclude all its dependencies them from the POM
def exclusionNode = dependencyNode.appendNode('exclusions').appendNode('exclusion')
exclusionNode.appendNode('groupId', '*')
exclusionNode.appendNode('artifactId', '*')
} else if (!dep.properties.excludeRules.empty) {
// Otherwise add specified exclude rules
def exclusionNode = dependencyNode.appendNode('exclusions').appendNode('exclusion')
dep.properties.excludeRules.each { ExcludeRule rule ->
exclusionNode.appendNode('groupId', rule.group ?: '*')
exclusionNode.appendNode('artifactId', rule.module ?: '*')
}
}
}
}
}
}
}
}
def libraryGroupId = group
def libraryVersion = version
artifactory {
contextUrl = '<artifactory_url>'
publish {
repository {
repoKey = '<repoKey>'
username = artifactory_username
password = artifactory_password
}
defaults {
android.buildTypes.all { variant ->
publications("${variant.name}Aar")
publishArtifacts = true
}
properties = ['qa.level': 'basic', 'dev.team': 'core']
publishPom = true
}
}
}
當我在我的筆記本電腦上運行該命令gradle build assembleRelease artifactoryPublish
,其上載於Artifactory的回購的aar
和pom
文件。
我嘗試使用Artifactory Deployment
任務在構建任務,做gradle build assembleRelease
(所以同樣的,但沒有發佈到artifactory的),然後再運行部署項目,但它而不是僅發佈AAR文件和artifactory的目錄結構沒有按看起來不一樣(它不會按子文件夾分解包名)。如何實現與竹相同?
這根本不回答問題。我在問如何使用插件發佈'aar'文件和'pom'文件,就像我沒有插件一樣。我知道這是兩個不同的事情,但我期望使用相同的結果,但情況並非如此 – Guillaume