All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nebula.plugin.bintray.NebulaOJOPublishingPlugin.kt Maven / Gradle / Ivy

There is a newer version: 8.5.0
Show newest version
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"))
                }
            })
        })
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy