使用此处的建议,我无法将我的android aar上传到我的Bintray帐户。我使用 gradlew bintrayUpload
获得了"构建成功",但在 bintray 中只可以看到 jar 文件和 pom 文件。这是我的顶级 gradle 文件
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
}
}
plugins {
id "com.jfrog.bintray" version "1.7.3"
}
allprojects {
repositories {
jcenter()
}
}
apply plugin: 'maven-publish'
apply plugin: 'java'
apply plugin: 'maven'
publishing {
publications {
MyPublication(MavenPublication) {
from components.java
groupId 'com.android.me.mylibrary'
artifactId 'demo-lib'
version '1.0.1'
}
}
}
这是我的 gradle 文件
apply plugin: 'com.android.library'
bintray {
user = user
key = key
publications = ['MyPublication'] //When uploading Maven-based publication files
//configurations = ['archives']
pkg {
repo = repo
name = 'demo-lib'
userOrg = userorg
labels = ['aar', 'android', 'example']
version {
name = '1.0.1'
}
}
}
android {
compileSdkVersion 26
buildToolsVersion "27.0.2"
defaultConfig {
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
testCompile 'junit:junit:4.12'
}
是不是少了点什么?我也尝试在这里使用示例脚本,但结果是相同的。此致敬意。。。
是的,实际上缺少一些东西。您不上传项目。您上传了工件 ID,但未上传工件。
因为有很多过时的教程,我实际上在这里发表了一篇关于这个的帖子。您还需要做的是遵循pom的maven规范.xml而我看到您没有。
在版本 4 中,它们还需要:
pom.withXml {
def root = asNode()
root.appendNode('description', "libraryDescription")
root.appendNode('name', "libraryName")
root.appendNode('url', "siteUrl")
root.children().last() + pomConfig
}
同样在pomConfig中,你应该像这样使用它:
def pomConfig = {
licenses {
license {
name "licenseName"
url "licenseUrl"
distribution "repo"
}
}
developers {
developer {
id "developerId"
name "developerName"
email "developerEmail"
}
}
scm {
url "gitUrl"
}
}
希望对您有所帮助!!