0

I'm encountering an error in my Gradle script where the plugins block throws the following error:

plugins block cannot be applied to (java.io.Serializable & java.lang.Comparable>).

Here is the relevant snippet of my script:

dependencies {
    ...
    intellijPlatform {
        ...
        def myPlugin = providers.gradleProperty("useLocal").get() == 'true' ?
            file("../path/to/local/plugin/") :
            'com.example.plugin:' + pluginVersion
        plugins myPlugin
        ...
    }
    ...
}

The else condition works fine because it handles strings (e.g., 'com.example.plugin:pluginVersion'), but the file() method in the if condition seems to be incompatible with the plugins block.

How can I correctly reference a local plugin path (../path/to/local/plugin/) in this case?

1
  • You can't apply the plugins block halfway through a script like that. It's a special block that executes before the rest of the script and, moreover, it can't accept arbitrary code like conditional paths or version numbers. It looks like you need a deeper rethink of your approach Commented Jan 29 at 12:47

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.