Cristian P.
Cristian P.

Reputation: 238

Import gradle class in another gradle file

I have a gradle class called CustomReport in my custom.gradle file. I want to import the CustomReport class and use it in jacoco.gradle file. How can I achieve that? The files are at the same level in the fileTree.

Upvotes: 2

Views: 1220

Answers (1)

Louis Jacomet
Louis Jacomet

Reputation: 14500

The easiest approach to share code between build scripts is to leverage Gradle's buildSrc folder.

It effectively allows to place code on the classpath of all build scripts of a project.

Have a look at the documentation for more details, including how to set it up for Groovy code.

Upvotes: 2

Related Questions