Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/opengl/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 正在跳过缺少aar和pom文件的上载_Android_Maven_Gradle_Pom.xml_Android Library - Fatal编程技术网

Android 正在跳过缺少aar和pom文件的上载

Android 正在跳过缺少aar和pom文件的上载,android,maven,gradle,pom.xml,android-library,Android,Maven,Gradle,Pom.xml,Android Library,我正在为Android构建一个aar库,我面临一个问题。POM和ARR文件未上载 有一个错误 正在跳过缺少文件“F:\Android\Personal\u Project\sampleMavenLib\sinalib\build\outputs\aar\sinalib release.aar”的上载。 正在跳过缺少文件“F:\Android\Personal\u Project\sampleMavenLib\sinalib\build\publications\Production\pom de

我正在为Android构建一个
aar
库,我面临一个问题。POM和ARR文件未上载

有一个错误

正在跳过缺少文件“F:\Android\Personal\u Project\sampleMavenLib\sinalib\build\outputs\aar\sinalib release.aar”的上载。 正在跳过缺少文件“F:\Android\Personal\u Project\sampleMavenLib\sinalib\build\publications\Production\pom default.xml”的上载

我检查了这两个路径,aar文件就在那里,并且生成了它,但是pom文件没有任何路径

这是我的格拉德尔

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"]
}

发布{
出版物{
制作(出版){
工件($buildDir/outputs/aar/sinalib release.aar)
组ID发布组ID
伪影伪影
版本库版本
//出版物不知道我们的依赖项,因此我们必须手动将它们添加到pom中
pom.withXml{
def dependenciesNode=asNode().appendNode('dependencies'))
//迭代编译依赖项(我们不需要测试依赖项),为每个依赖项添加一个节点
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凭据
属性=新属性()
加载(project.rootProject.file('local.properties')。newDataInputStrea(
))
user=properties.getProperty('user')
key=properties.getProperty('apikey')
覆盖=真
包装{
回购=bintrayRepo
name=project.name
userOrg='sinara'
许可证=所有许可证
desc=图书馆描述
websiteUrl=siteUrl
vcsUrl=gitUrl
版本{
名称=图书馆版本
}
发布=真
}
出版物=[“生产”]
}
依赖关系{
实现文件树(目录:“libs”,包括:['*.jar'])
实现'com.android.support:appcompat-v7:28.0.0-rc02'
测试实现'junit:junit:4.12'
androidTestImplementation'com.android.support.test:runner:1.0.2'
androidTestImplementation'com.android.support.test.espresso:espresso核心:3.0.2'
}
}

尝试为ReleasePublication生成EPOMFILE或将PublishReleasePublication发布到VenLocal

全文如下:

./gradlew clean build generatePomFileForReleasePublicationbintrayUpload -PbintrayUser=<BINTRAY_USER> -PbintrayKey=<BINTRAY_KEY> -PdryRun=false
/gradlew clean build generatePomFileForReleasePublicationbintrayUpload-PbintrayUser=-PbintrayKey=-PdryRun=false

在我尝试了很多东西之后,我发现了两点:

我改变了这个

artifact("$buildDir/outputs/aar/sinalib-release.aar")

2-您在中创建的存储库应与
pkg
部分中的repo相同

这解决了因缺少文件而跳过上载的错误
,并上载了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)
            }
//出版物不知道我们的依赖项,因此我们必须手动将它们添加到pom中
pom.withXml{
def dependenciesNode=asNode().appendNode('dependencies'))
//迭代编译依赖项(我们不需要测试依赖项),为每个依赖项添加一个节点
configurations.compile.allDependencies.each{
def dependencyNode=dependenciesNode.appendNode('dependency'))
dependencyNode.appendNode('groupId',it.group)
dependencyNode.appendNode('artifactId',it.name)
dependencyNode.appendNode('version',it.version)
}

我收到错误“Task”generatePomfileforReleasePublicationBintrayPload“未在项目中找到”:sinalib。“您是否正确地将BINTRAY_用户和密钥提供给了BINTRAY_?”是的,但据说没有像“generatePomfileforReleasePublicationBintrayPload”这样的任务。缺少POM的另一个解决方案:POM文件在上传时到底放在哪里?
clean build generatePomFileForProductionPublication bintrayUpload
//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)
            }