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

Gradle 4.10 #27

Closed mazuninky closed 6 years ago

mazuninky commented 6 years ago

I got the error(in IntelliJ IDEA) after update of my Gradle wrapper to 4.10

Publication with name 'defaultAar' not found.

My build.gradle.kts file is:

plugins {
    id("com.android.library")
    id("digital.wup.android-maven-publish") version "3.6.2"
}
publishing {
    (publications) {
        "defaultAar"(MavenPublication::class) {
            from(components["android"])
        }
    }
}
warnyul commented 6 years ago

In Kotlin DSL 1.0.0-rc3 container String invoke now is named() instead of maybeCreate() This change in behaviour can cause builds to fail with org.gradle.api.UnknownDomainObjectException. The fix is to explicitly call create or preferably register:

plugins {
    id("com.android.library")
    id("digital.wup.android-maven-publish") version "3.6.2"
}
publishing {
    (publications) {
        register("defaultAar", MavenPublication::class) {
            from(components["android"])
        }
    }
}