[GRADLE-2914] thirdparty plugins in settings.gradle cannot be applied by id Created: 04/Oct/13  Updated: 10/Feb/17  Resolved: 10/Feb/17

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Gradle Forums Assignee: Unassigned
Resolution: Won't Fix Votes: 1


I'm running into a minor problem, when applying a plugin in `settings.gradle`, running Gradle 1.8. When I apply it like this:

apply plugin: 'my-plugin'

buildscript {

{ url '' }

dependencies.classpath 'com.mycompany:myplugins:1.0.0'

I get this error:

  • What went wrong:
    A problem occurred evaluating settings 'main'.
    > Plugin with id 'my-plugin' not found.
  • Try:
    Run with --info or --debug option to get more log output.
  • Exception is:
    org.gradle.api.GradleScriptException: A problem occurred evaluating settings 'main'.
    at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:54)
    at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:132)
    at org.gradle.initialization.ScriptEvaluatingSettingsProcessor.applySettingsScript(ScriptEvaluatingSettingsProcessor.java:64)
    at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)
    at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
    Caused by: org.gradle.api.plugins.UnknownPluginException: Plugin with id 'my-plugin' not found.
    at org.gradle.api.internal.plugins.DefaultPluginRegistry.getTypeForId(DefaultPluginRegistry.java:82)
    at org.gradle.api.internal.plugins.DefaultPluginContainer.getTypeForId(DefaultPluginContainer.java:99)
    at org.gradle.api.internal.plugins.DefaultPluginContainer.apply(DefaultPluginContainer.java:34)
    at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.applyPlugin(DefaultObjectConfigurationAction.java:101)
    at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.access$200(DefaultObjectConfigurationAction.java:32)
    at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction$3.run(DefaultObjectConfigurationAction.java:72)
    at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.execute(DefaultObjectConfigurationAction.java:114)
    at org.gradle.groovy.scripts.DefaultScript.apply(DefaultScript.java:91)
    at org.gradle.api.Script$apply.callCurrent(Unknown Source)
    at settings_6m70vs06evv92jp7124mju1vbd.run(C:\Data\p4workspace\COMMON\core.3\settings.gradle:1)
    at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:52)
    ... 29 more

The `META-INF/gradle-plugins/my-plugin.properties` file seems to be fine, and when I use the class name, it works:

apply plugin: com.mycompany.MyPlugin

In the same Jar I have a couple of plugins that are applied to `Project`, and all of them work as expected.

Comment by Gradle Forums [ 04/Oct/13 ]


Did you try to apply this plugin in a regular build.gradle file?

Comment by Gradle Forums [ 04/Oct/13 ]

I thought about this a bit more.

I haven't seen a use case for applying plugins in settings.gradle, yet. Typical Gradle plugin is an object that is a applied to a 'project' instance (e.g. implements Plugin) . In settings.gradle, there's no 'project' instance yet, because the it's the settings.gradle that defines the projects.

You can try writing the plugin that implements Plugin and apply it in the settings.gradle. I cannot try it out right now and I'm not sure if that's what you want.

The bottom line is that you cannot use a regular plugin in settings.gradle because regular plugin are intended to be applied to 'project' instances.

Hope that helps!

Comment by Benjamin Muschko [ 15/Nov/16 ]

As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub.

We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to.

Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:

  • Checking that your issues contain requisite context, impact, behaviors, and examples as described in our published guidelines.
  • Leave a comment on the JIRA issue or open a new GitHub issue confirming that the above is complete.

We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle!

Comment by Benjamin Muschko [ 10/Feb/17 ]

Thanks again for reporting this issue. We haven't heard back from you after our inquiry from November 15th. We are closing this issue now. Please create an issue on GitHub if you still feel passionate about getting it resolved.

Generated at Wed Jun 30 12:34:52 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.