nebula.plugin.bintray.NebulaOJOPublishingPlugin.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nebula-bintray-plugin Show documentation
Show all versions of nebula-bintray-plugin Show documentation
Nebula bintray publishing using Gradle's MavenPublication
package nebula.plugin.bintray
import groovy.lang.GroovyObject
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.delegateClosureOf
import org.jfrog.gradle.plugin.artifactory.ArtifactoryPlugin
import org.jfrog.gradle.plugin.artifactory.dsl.ArtifactoryPluginConvention
import org.jfrog.gradle.plugin.artifactory.dsl.PublisherConfig
class NebulaOJOPublishingPlugin : Plugin {
override fun apply(project: Project) {
project.plugins.apply(ArtifactoryPlugin::class.java)
if (project == project.rootProject) {
configureArtifactory(project)
}
}
private fun configureArtifactory(project: Project) {
val artifactoryConvention = project.convention.plugins.get("artifactory") as ArtifactoryPluginConvention
artifactoryConvention.setContextUrl("https://oss.jfrog.org")
artifactoryConvention.publish(delegateClosureOf {
repository(delegateClosureOf {
setProperty("repoKey", "oss-snapshot-local")
if (project.hasProperty("bintrayUser")) {
setProperty("username", project.property("bintrayUser"))
setProperty("password", project.property("bintrayKey"))
}
})
})
}
}