Gradle kotlin dsl with jfrog artifactory plugin - disable publish build info

Viewed 422

I'm trying to stop our artifactory job from publishing any build info. According to the jfrog docs, setting publishBuildInfo = false should do that for me. However, if I try to set the property in our gradle kotlin dsl, I get the following error:

Could not set unknown property 'publishBuildInfo' for task ':artifactoryPublish' of type org.jfrog.gradle.plugin.artifactory.task.ArtifactoryTask.

Here is our build.gradle.kts file. I replaced everything that should be irrelevant by ...:

...


plugins {
    ...
    id("com.jfrog.artifactory") version "4.24.20"
    ...
}

...

artifactory {
    setContextUrl("someUrl")

    ...

    publish(delegateClosureOf<org.jfrog.gradle.plugin.artifactory.dsl.PublisherConfig> {

        repository(delegateClosureOf<groovy.lang.GroovyObject> {
            ...
        })

        defaults(delegateClosureOf<groovy.lang.GroovyObject> {
            invokeMethod("publications", "mavenJava")
            setProperty("publishPom", true)
            setProperty("publishArtifacts", true)
            setProperty("publishBuildInfo", false)
        })
    })
}
2 Answers

Use invokeMethod

configure<org.jfrog.gradle.plugin.artifactory.dsl.ArtifactoryPluginConvention> {
    publish {
        defaults {
            invokeMethod("setPublishBuildInfo", false)
        }
    }
}

I got this from the deleted answer. Not sure why it was deleted since it worked and saved my life :)

One more from me. Had been struggling with turning off that PublisherBuildInfo via Kotlin DSL in gradle. The above mentioned method didn't quite work for me so I ended up with clientConfig.publisher.isPublishBuildInfo = false inside artifactory block which worked for id("com.jfrog.artifactory") version "4.28.1".

For example:

...
artifactory {
    setContextUrl("https://-our-artifactory-url")
    clientConfig.publisher.isPublishBuildInfo = false

    publish(
        delegateClosureOf<PublisherConfig> {
            repository(
                delegateClosureOf<GroovyObject> {
...
Related