Plugin project with samples in one repository

Is there any official way how to create the Gradle plugin project together with samples that allows testing plugin directly without publishing it.

When I put plugin to buildSrc it is very easy to use it directly in the sample project inside of one repo without any additional step. But then it is not possible to publish it to the artifactory.

When I create a normal module, which is possible to publish to artifactory, there is no way how to use it inside of the sample project without publishing it to local maven artifactory after every change. Maybe composite build can help here?

Currently, I’m using a little bit hacky way. I have the plugin module and then buildSrc where is inside of settings.gradle this

include ':plugin'
project(':plugin').projectDir = new File(rootDir, '../plugin')

And inside of build.gradle this

rootProject.dependencies {
    implementation project(':plugin')

So I basically use the plugin module as the dependency of buildSrc, which is without real source code.
It works great from a command line, but it causes sync issue in IDEA as I described here

You can do it with a composite build.
See an example here, I use a version.txt file to share the version amongst the composite