Putting my gradle scripts in `gradle` directory created by wrapper task?

I have many *.gradle scripts in my project root directory, so I want to put them into some directory. Is it OK to use root gradle directory that is created by wrapper task? I’m concerned that the directory may be updated or deleted by other tasks or something else.
I’m assuming the following directory structure.

├── script # <- my script directory
│   ├── a.gradle
│   └── b.gradle
└── wrapper
    ├── gradle-wrapper.jar
    └── gradle-wrapper.properties

Generally this is perfectly fine.
But you should strongly consider not to use script plugins.
They often just cause more trouble than they do good.
They partly have strange behavior due to classpath shenenigans, you cannot use the plugins { ... ] DSL, …

Better use precompiled script plugins.
They can as well be in Groovy DSL and thus will look almost the same, with the exception that the plugins { ... } DSL is supported, and they work much better and more predictable.

1 Like

Thank you, I didn’t know about precompiled script plugins. I’ll check it out later.