Cannot configure the 'publishing' extension after it has been accessed

I’m trying to sign a publication, but am getting the mentioned error. I don’t see why, as I’m following the docs exactly (I believe). Any insight would be much appreciated.

apply plugin: 'signing'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'com.jfrog.artifactory'
//apply plugin: 'maven'
apply plugin: 'maven-publish'
//apply plugin: 'nebula.provided-base'

task javadocJar(type: Jar, dependsOn: javadoc) {
    classifier = 'javadoc'
    from 'build/javadoc'
}

task sourcesJar(type: Jar) {
    from sourceSets.main.allSource
    classifier = 'sources'
}

artifacts {
    archives jar

    archives javadocJar
    archives sourcesJar
}


import org.gradle.plugins.signing.Sign

gradle.taskGraph.whenReady { taskGraph ->
    if (taskGraph.allTasks.any { it instanceof Sign }) {
        allprojects { ext."signing.keyId" = findProperty('signing.keyId') ?: System.getenv('SIGNING_KEY_ID') }
        allprojects { ext."signing.secretKeyRingFile" = findProperty('signing.secretKeyRingFile') ?: System.getenv('SIGNING_KEYRING_FILE') }
        allprojects { ext."signing.password" = findProperty('signing.password') ?: System.getenv('SIGNING_PASSWORD') }
    }
}

publishing {
    publications {
        mavenKotlin(MavenPublication) {
            from components.java
            artifact javadocJar
            artifact sourcesJar
            pom {
                scm {
                    url = 'scm:git@github.com:snowe2010/axon-kotlin.git'
                    connection = 'scm:git@github.com:snowe2010/axon-kotlin.git'
                    developerConnection = 'scm:git@github.com:snowe2010/axon-kotlin.git'
                }

                licenses {
                    license {
                        name = 'MIT'
                        url = 'https://opensource.org/licenses/MIT'
                        distribution = 'repo'
                    }
                }

                developers {
                    developer {
                        id = 'snowe2010'
                        name = 'Tyler Thrailkill'
                        email = 'tyler.b.thrailkill@gmail.com'
                    }
                }
            }
        }
    }
}

signing {
    println(publishing.publications.mavenKotlin)
    sign publishing.publications.mavenKotlin
}

install {
    repositories.mavenInstaller {
        pom.project {
            name 'Axon-Kotlin'
            packaging 'jar'
            description 'Kotlin extensions for Axon.'
            url 'https://github.com/snowe2010/axon-kotlin'

            scm {
                url 'scm:git@github.com:snowe2010/axon-kotlin.git'
                connection 'scm:git@github.com:snowe2010/axon-kotlin.git'
                developerConnection 'scm:git@github.com:snowe2010/axon-kotlin.git'
            }

            licenses {
                license {
                    name 'MIT'
                    url 'https://opensource.org/licenses/MIT'
                    distribution 'repo'
                }
            }

            developers {
                developer {
                    id 'snowe2010'
                    name 'Tyler Thrailkill'
                }
            }
        }
    }
}

bintray {
    user = findProperty('bintrayUsername') ?: System.getenv('BINTRAY_USER')
    key = findProperty('bintrayApiKey') ?: System.getenv('BINTRAY_KEY')

//    configurations = ['archives']
    publications = ['mavenKotlin']

    publish = true

    pkg {
        repo = 'maven'
        name = 'Axon-Kotlin'
        licenses = ['MIT']
        vcsUrl = 'https://github.com/snowe2010/axon-kotlin.git'

        version {
            name = gradle.version

//            gpg {
//                sign = true
//            }

            mavenCentralSync {
                sync = true
                user = project.findProperty('sonatypeUsername') ?: System.getenv('SONATYPE_USERNAME')
                password = project.findProperty('sonatypePassword') ?: System.getenv('SONATYPE_PASSWORD')
                close = '1'
            }
        }
    }
}

artifactory {
    contextUrl = 'http://oss.jfrog.org'
    publish {
        repository {
            repoKey = 'oss-snapshot-local'
            username = project.findProperty('bintrayUsername') ?: System.getenv('BINTRAY_USER')
            password = project.findProperty('bintrayApiKey') ?: System.getenv('BINTRAY_KEY')
        }
        defaults {
            publications('mavenKotlin')
            publishArtifacts = true
            publishPom = true
        }
    }
    resolve {
        repoKey = 'jcenter'
    }
    clientConfig.info.setBuildNumber('' + new Random(System.currentTimeMillis()).nextInt(20000))
}

The issue seems to be something to do with the new ‘signing publications’ functionality. I’m pretty new to gradle, so I don’t understand how to even debug this issue.

It seemed to be something to do with having nebula.provided-base applied.