wupdigital / android-maven-publish

Modification of the standard Maven Publish plugin to be compatible with android-library projects (aar).
Apache License 2.0
326 stars 39 forks source link

from components.android error: Cannot get property 'allDependencies' on null object #15

Closed tonisives closed 6 years ago

tonisives commented 6 years ago

Hello, I have released a version of my .aar before and everything was successful. Now, if I go back to to the commit I made the release from, I get this error.

Cannot get property 'allDependencies' on null object

It comes from the publication line from components.android

publishing {
    publications {
        aar(MavenPublication) {
            from components.android
        }
    }
}

It works when I specify the artifact like this:

aar(MavenPublication) {
    //from components.android
    groupId "${artifactProperties.groupId}"
    version "${artifactProperties.version}"
    artifact("$buildDir/outputs/aar/hmkit-android-release.aar")

    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)
        }
    }
}

But this way the pom file does not have any dependencies.

Why do I get this null object error? Why did it work before and not now?

Im using gradle 4.6 and this release is from an Android projects module.

Off-topic: Why could it be that the dependencies loop is not adding to the pom?

tonisives commented 6 years ago

This null error disappears if I delete apply plugin: 'com.jfrog.artifactory'.

But then I get another error Could not find method artifactory()

Maybe artifactory plugin update broke this? I am using classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4+" so im getting automatic updates.

tonisives commented 6 years ago

Ok, if I use classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:4.5.0' then the error disappears and I can make the release.

nhaarman commented 6 years ago

Well, downgrading isn't really fixing the problem, is it?