【问题标题】:Andorid maven publish artifactory error after updating Gradle plugin更新 Gradle 插件后,Android maven 发布工件错误
【发布时间】:2022-01-18 12:43:28
【问题描述】:

您好,我正在使用具有以下设置的 Android Studio:

Android Studio 版本-北极狐

Google 服务 - com.google.gms:google-services:4.3.8

AGP : com.android.tools.build:gradle:7.0.4

gradle 版本:https://services.gradle.org/distributions/gradle-7.0.2-bin.zip

我正在尝试使用以下代码在我的内部工件上发布一个工件

plugins {
    id 'com.android.library'
    id 'kotlin-android'
    id 'maven-publish'
    id 'com.jfrog.artifactory'
}

publishing {
    publications {
        aar(MavenPublication) {
            groupId libraryGroupId
            version libraryVersion
            artifactId libraryArtifactId

            artifact("$buildDir/outputs/aar/abc-release.aar")
//
            pom.withXml {
                def dependenciesNode = asNode().appendNode('dependencies')
                def deps = configurations.implementation.allDependencies + configurations.api.allDependencies
                deps.each {
                    if (it.group != null && (it.name != null || "unspecified".equals(it.name)) && it.version != null && !"unspecified".equals(it.version)) {
                        def dependencyNode = dependenciesNode.appendNode('dependency')
                        dependencyNode.appendNode('groupId', it.group)
                        dependencyNode.appendNode('artifactId', it.name)
                        dependencyNode.appendNode('version', it.version)
                    }
                }
            }
        }
    }
}

artifactory {
    contextUrl = 'http://artifactory.local.com/artifactory'
    publish {
        repository {
            repoKey = libraryGroupId
            username = "${artifactory_user}"
            password = "${artifactory_password}"

        }
        defaults {
            publications('aar')
            publishArtifacts = true
            properties = ['qa.level': 'basic', 'dev.team': 'core']
            publishPom = true
        }
    }
}

我正在尝试使用以下命令发布工件:

./gradlew :module:clean && ./gradlew :module:assembleRelease && ./gradlew :module:artifactoryPublish

它给了我以下问题:

* What went wrong:
 Some problems were found with the configuration of task ':module:artifactoryPublish' (type 'ArtifactoryTask').
- Type 'org.jfrog.gradle.plugin.artifactory.task.ArtifactoryTask' field 'mavenPublications' without corresponding getter has been annotated with @Input, @Optional.
  
  Reason: Annotations on fields are only used if there's a corresponding getter for the field.
  
  Possible solutions:
    1. Add a getter for field 'mavenPublications'.
    2. Remove the annotations on 'mavenPublications'.
  
  Please refer to https://docs.gradle.org/7.0.2/userguide/validation_problems.html#ignored_annotations_on_field for more details about this problem.
- Type 'org.jfrog.gradle.plugin.artifactory.task.ArtifactoryTask' field 'publishConfigs' without corresponding getter has been annotated with @InputFiles, @Optional.
  
  Reason: Annotations on fields are only used if there's a corresponding getter for the field.
  
  Possible solutions:
    1. Add a getter for field 'publishConfigs'.
    2. Remove the annotations on 'publishConfigs'.
  
  Please refer to https://docs.gradle.org/7.0.2/userguide/validation_problems.html#ignored_annotations_on_field for more details about this problem.
- Type 'org.jfrog.gradle.plugin.artifactory.task.ArtifactoryTask' property 'deployDetails' is missing an input or output annotation.
  
  Reason: A property without annotation isn't considered during up-to-date checking.
  
  Possible solutions:
    1. Add an input or output annotation.
    2. Mark it as @Internal.
  
  Please refer to https://docs.gradle.org/7.0.2/userguide/validation_problems.html#missing_annotation for more details about this problem.
- Type 'org.jfrog.gradle.plugin.artifactory.task.ArtifactoryTask' property 'evaluated' is missing an input or output annotation.
  
  Reason: A property without annotation isn't considered during up-to-date checking.
  
  Possible solutions:
    1. Add an input or output annotation.
    2. Mark it as @Internal.
  
  Please refer to https://docs.gradle.org/7.0.2/userguide/validation_problems.html#missing_annotation for more details about this problem.

 * Try:

更新 gradle 版本后开始出现问题。在较旧的 gradle 版本上,我能够发布工件。

【问题讨论】:

  • 你解决推送的问题了吗?泰
  • 是的。需要更新 jfrog 版本到这个org.jfrog.buildinfo:build-info-extractor-gradle:4.26.1
  • 是的 :) 你说得对,我用这个更新解决了
  • 如果您回复解决方案,我会给您投票!
  • 升级到最新版本 - 4.29.1 - 为我解决了这个问题。感谢指针@nilkash

标签: android gradle groovy artifactory


【解决方案1】:

感谢 @nilkash 提出修复建议。

确认将 jfrog 版本更新为 org.jfrog.buildinfo:build-info-extractor-gradle:4.28.1 解决了我的问题。

【讨论】:

    猜你喜欢
    • 2021-12-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-11-15
    • 2020-07-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多