Hi, everyone. I used the buildSrc in my multi modu...
# community-support
s
Hi, everyone. I used the buildSrc in my multi module android Project like this. The
publish-java-lib.gradle.kts
file like below:
Copy code
plugins {
    `maven-publish`
}

repositories {
    gradlePluginPortal()
}

publishing {
    publications {
        create<MavenPublication>("mavenJava") {
            from(components["java"])
        }
    }
    repositories {
        maven {
            url = uri(extra["NEXUS_MAVEN_REPO_URL"] as String)
            isAllowInsecureProtocol = true
            credentials {
                username = extra["NEXUS_MAVEN_USERNAME"] as String
                password = extra["NEXUS_MAVEN_PASSWORD"] as String
            }
        }
    }
}
when i apply the convention plugin in my module like below:
Copy code
plugins {
    id("publish-java-lib")
}
it shows me the error. how to fix it?
Copy code
An exception occurred applying plugin request [id: 'publish-java-lib']
> Failed to apply plugin 'publish-java-lib'.
   > Build was configured to prefer settings repositories over project repositories but repository 'Gradle Central Plugin Repository' was added by plugin 'publish-java-lib'
t
This is due to:
Copy code
repositories {
    gradlePluginPortal()
}
Do you really need it? (I'd say no at first glance)
s
@Thomas Broyer 🤣so cool, but why? I need the maven-publish plugin to implement the maven publish function. Did it need the repo location to find the maven-publish plugin?
t
At the time that
repositories {}
block is executed, the plugin has already been applied. Also
maven-publish
is built into Gradle.
👍 1