Closed maksym-moroz closed 6 months ago
@maksym-moroz Appreciate you flagging this problem! Could you please share a basic reproducer project? Just a small GitHub project that we can fork to replicate the issue. Thanks!
For those interested in extracting jfrog-artifactory
setup into a precompiled convention plugin, here is the quick guide.
To apply jfrog-artifactory
inside your convention plugin you first need to satisfy the dependency on it inside build.gradle.kts for your included build
dependencies {
implementation(libs.jfrog.artifactory)
}
This is where I faced the problem since applying a plugin via implementation is not allowed. Here is the Gradle spec for addressing this problem, however it's not done yet but there is a workaround described, copying it here in case the link dies:
It is currently not possible to use the plugin id (and version) or the version catalog for dependency declaration, which means the required coordinates have to be known or be derived somehow. The steps to retrieve the coordinates are manual and cumbersome: One has to lookup the plugin on the Plugin Portal, find the coordinates in the legacy snippet at the bottom and copy them from there.
For jfrog-artifactory
legacy path is org.jfrog.buildinfo:build-info-extractor-gradle
Adding this as a library to the version catalog and then referring to it from build.gradle.kts dependencies block allows you to add id("com.jfrog.artifactory") to your precompiled convention plugin.
For some reason using artifactory {}
block is not possible as it keeps getting unrecognised after getting generated.
For those wondering how to configure it in case you face the same issue, extension is called ArtifactoryPluginConvention
, i.e. configure<ArtifactoryPluginConvention> {...}
Hope this helps.
Thank you very much for your guidance, @maksym-moroz! It will certainly be beneficial to others who encounter this issue.
Describe the bug
Specifying the dependency in a root-level
build.gradle.kts
with a version directly or via version catalog and not applying it but instead opting to apply it inside build-logic convention plugin produces the following error logCurrent behavior
Unable to apply
com.jfrog.artifactory
plugin to lift out the publishing logic into a convention pluginReproduction steps
No response
Expected behavior
Being able to set up publishing from a convention plugin inside an included build
Artifactory Gradle plugin version
5.1.13 or any
Operating system type and version
MacOS
JFrog Artifactory version
No response
Gradle version
8.2.0