Setting script plugin DSL

Hi, from root project settings.gradle I use plugins{} DSL.
Navigating to the source of it, I found that it throw an exception.
Why I still can execute tasks normally while plugins{} throw exception?

Because it is a DSL.
The code you see there is not necessarily the code that is executed.
The plugins { ... } for example is also extracted and applied to a dummy project separately before your build script is executed to find out which type-safe accessors to genearate and so on.
The method you navigated to is just for cases where the block is used somewhere else where it is not rewritten and thus indeed throws that exception.

1 Like