GetByName configurations do not work in gradle when publishing POM file to Artifactory

I use the publish section in the build.gradle file to publish the Android library to Artifactory:

publishing {
  publications {
    aar(MavenPublication) {
        groupId packageName
        version = libraryVersion
        artifactId project.getName()

        // Tell maven to prepare the generated "*.aar" file for publishing
        artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")

        pom.withXml {
                def dependencies = asNode().appendNode('dependencies')
                configurations.getByName("_releaseCompile").getResolvedConfiguration().getFirstLevelModuleDependencies().each {
                    def dependency = dependencies.appendNode('dependency')
                    dependency.appendNode('groupId', it.moduleGroup)
                    dependency.appendNode('artifactId', it.moduleName)
                    dependency.appendNode('version', it.moduleVersion)
                }
            }
        }
    }
}

The following error failed:

Execution failed for task ':smartcardsdk:generatePomFileForAarPublication'.
> Could not apply withXml() to generated POM
> Configuration with name '_releaseCompile' not found.

This is not a problem with Android v2.x. The problem started when I upgraded to Android Studio v3 (and, I think, Gradle v3.0.0).

I assume that the configurations are no longer saved with the name _releaseCompile.

Does anyone know what a new "name" should be?

Thank.

+4
source share
1 answer

Just figured it out. You must change it to:

"releaseCompileClasspath"
+4
source

Source: https://habr.com/ru/post/1688681/


All Articles