How to apply plugin from included build?

Currently I have a project with some plugins, that will be published to private maven, but before publishing I want to test this plugins. I’ve created test project like this:

plugins
|- src
|- test
|- build.gradle
test-project
|- build.gradle
|- settings.gradle

And in test-project/settings.gradle I’ve included plugins:

includeBuild '../gradle-plugins'

And then I try to apply one of plugins in test-project/build.gradle:

plugins {
  id 'groovy'
  id 'com.company.plugin' // here I got an error "Plugin was not found"
}

Is there a way to apply plugin in layout like that?

I think id works only for published plugins.

Can you try so: apply plugin: "<YOUR-PLUGIN-ID-FROM-PROPERTY-FILE>"?

You can find plugin id in *.properties file (https://docs.gradle.org/current/userguide/custom_plugins.html#sec:custom_plugins_standalone_project)

Thanks for reply!

Just tried that, did’t work :slightly_frowning_face:

Also tried to use apply from just in case, not work too

Can you upload example project? So I can figure it out how to fix it.

Sure. Thanks for helping me!

There is a link to sample repo: github

I’ve also included code with workaraund at test-project/settings.gradle for further searchers. The idea is: publish plugin to private maven repo as snapshot. But there is another problem, pluginManagement can’t include snapshot modules or modules with dynamic versions, so I should specify every new version by hand

It looks like you have some issues with plugin configuration (and package names were incorrect). I guess you copied it from existing project.

Check PR from your project (https://github.com/veloc1/gradle-plugin-in-included-build-sample/pull/1). It works on my machine :smile:
This gradle example helps me (https://github.com/gradle/gradle/tree/v3.1.0/subprojects/docs/src/samples/compositeBuilds/plugin-dev).

1 Like

Wow, thanks!

My bad, didn’t notice samples/compositeBuilds and missed links to this plugin java gradle plugin. Documentation is really unclear about that.

Problem resolved now, thanks for help, @nerro!