import org.gradle.api.publish.PublishingExtension apply(plugin = "maven-publish") afterEvaluate { if (extensions.findByName("android") != null) { val releaseComponent = components.findByName("release") ?: return@afterEvaluate extensions.configure { publications { register("release") { from(releaseComponent) groupId = rootProject.group.toString() artifactId = project.name version = rootProject.version.toString() } } repositories { maven { url = uri(rootProject.extra["nexusUrl"] as String) credentials { username = rootProject.extra["nexusUser"] as String password = rootProject.extra["nexusPassword"] as String } } } } } }