only build script and other plugins script blocks are allowed before plugins

后端 未结 1 1046
野的像风
野的像风 2020-12-15 16:28

I want to use gradle plugin having this syntax

 plugins {
  id \"id\" version \"version\"
}

but i have the error of

only bu         


        
相关标签:
1条回答
  • 2020-12-15 17:21

    Whenever you write a build.gradle script and use the new plugins script block, you need to put it as first block in the file. The only exceptions from this rule are other plugins blocks or the special buildScript block, which always must go first.

    As an example, this script is fine:

    plugins {
        // ...
    }
    
    dependencies {
        // ...
    }
    

    This one is also fine:

    buildScript {
        // ...
    }
    
    plugins {
        // ...
    }
    
    repositories {
        // ...
    }
    

    But this one is invalid:

    repositories {
         // ...
    }
    
    plugins {
        // ...
    }
    
    0 讨论(0)
提交回复
热议问题