跳过缺少 aar 和 pom 文件的上传
Skipping upload for missing aar and pom file
我正在为 Android 构建一个 aar
库,我遇到了一个问题。未上传 POM 和 ARR 文件。
有错误
Skipping upload for missing file 'F:\Android\Personal_Project\sampleMavenLib\sinalib\build\outputs\aar\sinalib-release.aar'.
Skipping upload for missing file 'F:\Android\Personal_Project\sampleMavenLib\sinalib\build\publications\Production\pom-default.xml'.
我检查了这两个路径,aar 文件在那里并生成了它,但是没有任何 pom 文件的路径
这是我的gradle
apply plugin: 'com.android.library'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'maven-publish'
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 17
targetSdkVersion 28
versionCode 1
versionName "1.0.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
}
}
ext {
bintrayRepo = 'maven'
bintrayName = 'sinalib'
publishedGroupId = 'come.sinarahimi.sinalib'
libraryName = 'Sinalib'
artifact = 'sinalib'
libraryDescription = 'This view is a container that supports diagonal scroll and fling gesture. It is based on AOSP HorizontalScrollView.'
siteUrl = 'https://github.com/Sinarahimi/sampleMavenLib'
gitUrl = 'https://github.com/Sinarahimi/sampleMavenLib.git'
libraryVersion = '1.0.2'
developerId = 'sinarahimi'
developerName = 'Sina RAHIMI'
developerEmail = 'develop.rahimi95@gmail.com'
licenseName = 'The Apache Software License, Version 2.0'
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
allLicenses = ["Apache-2.0"]
}
publishing {
publications {
Production(MavenPublication) {
artifact("$buildDir/outputs/aar/sinalib-release.aar")
groupId publishedGroupId
artifactId artifact
version libraryVersion
//The publication doesn't know about our dependencies, so we have to manually add them to the pom
pom.withXml {
def dependenciesNode = asNode().appendNode('dependencies')
//Iterate over the compile dependencies (we don't want the test ones), adding a <dependency> node for each
configurations.compile.allDependencies.each {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
}
bintray {
// Get Bintray credential from environment variable
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStrea(
))
user = properties.getProperty('user')
key = properties.getProperty('apikey')
override = true
pkg {
repo = bintrayRepo
name = project.name
userOrg = 'sinara'
licenses = allLicenses
desc = libraryDescription
websiteUrl = siteUrl
vcsUrl = gitUrl
version {
name = libraryVersion
}
publish = true
}
publications = ['Production']
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-rc02'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
}
尝试 generatePomFileForReleasePublication 或 publishReleasePublicationToMavenLocal。
完整的表扬是:
./gradlew clean build generatePomFileForReleasePublicationbintrayUpload -PbintrayUser=<BINTRAY_USER> -PbintrayKey=<BINTRAY_KEY> -PdryRun=false
在我尝试了很多事情之后,我发现了两点:
1 - 我改变了这个
artifact("$buildDir/outputs/aar/sinalib-release.aar")
到
artifact("build/outputs/aar/sinalib-release.aar")
2 - 您在 bintray.com 中创建的存储库应与 pkg
部分中的存储库相同。
这解决了错误 Skipping upload for missing file
并上传了 arr 文件。
但是仍然存在一个错误,它无法上传和生成 pom
文件。
所以我找到了这个命令:
clean build generatePomFileForProductionPublication bintrayUpload
它对我有用,但在将依赖项添加到 pom 时仍然存在问题
虽然我有这段代码,但它不起作用:
//The publication doesn't know about our dependencies, so we have to manually add them to the pom
pom.withXml {
def dependenciesNode = asNode().appendNode('dependencies')
//Iterate over the compile dependencies (we don't want the test ones), adding a <dependency> node for each
configurations.compile.allDependencies.each {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
我正在为 Android 构建一个 aar
库,我遇到了一个问题。未上传 POM 和 ARR 文件。
有错误
Skipping upload for missing file 'F:\Android\Personal_Project\sampleMavenLib\sinalib\build\outputs\aar\sinalib-release.aar'. Skipping upload for missing file 'F:\Android\Personal_Project\sampleMavenLib\sinalib\build\publications\Production\pom-default.xml'.
我检查了这两个路径,aar 文件在那里并生成了它,但是没有任何 pom 文件的路径
这是我的gradle
apply plugin: 'com.android.library'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'maven-publish'
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 17
targetSdkVersion 28
versionCode 1
versionName "1.0.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
}
}
ext {
bintrayRepo = 'maven'
bintrayName = 'sinalib'
publishedGroupId = 'come.sinarahimi.sinalib'
libraryName = 'Sinalib'
artifact = 'sinalib'
libraryDescription = 'This view is a container that supports diagonal scroll and fling gesture. It is based on AOSP HorizontalScrollView.'
siteUrl = 'https://github.com/Sinarahimi/sampleMavenLib'
gitUrl = 'https://github.com/Sinarahimi/sampleMavenLib.git'
libraryVersion = '1.0.2'
developerId = 'sinarahimi'
developerName = 'Sina RAHIMI'
developerEmail = 'develop.rahimi95@gmail.com'
licenseName = 'The Apache Software License, Version 2.0'
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
allLicenses = ["Apache-2.0"]
}
publishing {
publications {
Production(MavenPublication) {
artifact("$buildDir/outputs/aar/sinalib-release.aar")
groupId publishedGroupId
artifactId artifact
version libraryVersion
//The publication doesn't know about our dependencies, so we have to manually add them to the pom
pom.withXml {
def dependenciesNode = asNode().appendNode('dependencies')
//Iterate over the compile dependencies (we don't want the test ones), adding a <dependency> node for each
configurations.compile.allDependencies.each {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
}
bintray {
// Get Bintray credential from environment variable
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStrea(
))
user = properties.getProperty('user')
key = properties.getProperty('apikey')
override = true
pkg {
repo = bintrayRepo
name = project.name
userOrg = 'sinara'
licenses = allLicenses
desc = libraryDescription
websiteUrl = siteUrl
vcsUrl = gitUrl
version {
name = libraryVersion
}
publish = true
}
publications = ['Production']
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-rc02'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
}
尝试 generatePomFileForReleasePublication 或 publishReleasePublicationToMavenLocal。
完整的表扬是:
./gradlew clean build generatePomFileForReleasePublicationbintrayUpload -PbintrayUser=<BINTRAY_USER> -PbintrayKey=<BINTRAY_KEY> -PdryRun=false
在我尝试了很多事情之后,我发现了两点:
1 - 我改变了这个
artifact("$buildDir/outputs/aar/sinalib-release.aar")
到
artifact("build/outputs/aar/sinalib-release.aar")
2 - 您在 bintray.com 中创建的存储库应与 pkg
部分中的存储库相同。
这解决了错误 Skipping upload for missing file
并上传了 arr 文件。
但是仍然存在一个错误,它无法上传和生成 pom
文件。
所以我找到了这个命令:
clean build generatePomFileForProductionPublication bintrayUpload
它对我有用,但在将依赖项添加到 pom 时仍然存在问题 虽然我有这段代码,但它不起作用:
//The publication doesn't know about our dependencies, so we have to manually add them to the pom
pom.withXml {
def dependenciesNode = asNode().appendNode('dependencies')
//Iterate over the compile dependencies (we don't want the test ones), adding a <dependency> node for each
configurations.compile.allDependencies.each {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}