jfrog / artifactory-gradle-plugin

JFrog Gradle plugin for Build Info extraction and Artifactory publishing.
Apache License 2.0
20 stars 15 forks source link

Bug with getPublisherConfig() #80

Open lbleier-GSFC opened 8 months ago

lbleier-GSFC commented 8 months ago

Describe the bug

I am not sure if this is a usage issue on my end, but when I attempt to use GradleRunner.build() I get an UnexpectedBuildError from Gradle

Current behavior

When running functional tests on my software, using GradleRunner.build(), I get the following error:

Cannot invoke "org.jfrog.gradle.plugin.artifactory.dsl.PublisherConfig.repository(org.gradle.api.Action)" because the return value of "org.jfrog.gradle.plugin.artifactory.dsl.ArtifactoryPluginConvention.getPublisherConfig()" is null

Reproduction steps

No response

Expected behavior

That the tests will pass

Artifactory Gradle plugin version

5.1.10

Operating system type and version

Ubuntu Linux 20.04.6

JFrog Artifactory version

No response

Gradle version

8.4

yahavi commented 7 months ago

@lbleier-GSFC Thanks for reporting this issue. Could you kindly furnish additional details regarding your build script or the steps necessary to replicate the issue? Your input is valuable.

lbleier-GSFC commented 7 months ago

I have looked further into this, and it looks like my code is calling getPublisherConfig() right after constructing an ArtifactoryPluginConvention object. Based on the code seen here, it looks like doing so would result in a null returned, although there's no warning of this. It would seem that the only way to populate the publisherConfig object is to first call publish()

Generally speaking, I am trying to configure the plugin from within a Java class, and am not sure how to do it. The documentation in the README only covers Kotlin/Groovy configs.