Use external files for a gradle project


I have several Kotlin DSL Gradle projects that use the same methods written in CommonA.kt and CommonB.kt.
After research, I have found that we can create another gradle project (called common-project) with CommonA.kt and CommonB.kt files and include this common-project in the other ones.

But I do not want to handle a gradle project with all the dependencies.
My request : I would like to create a simple directory with all these common files, and from this directory all my other gradle projects are able to build and compile them “automatocally”, is it possible ?
Ideally, I wonder if I can generate automatically a project from these common files then include it in my other ones.

Thank you very much !

You can use a File or a URL as a plugin. Be sure to include a version number in the path.


apply from: 'file:c:/common/gradle/1.0.0/build.gradle' 


apply from: ''

See PluginAware.apply(Map)

1 Like