How do I import Groovy class for use in Gradle buld script>

I have some gradle build scripts in a directory and I want to share a class in a Groovy file.

I could care less about building groovy/java projects, Maven repositories, and all of that, so I am not using those plugins. I use gradle for dependency management and moving and copying files for a large MS .NET build. If any of you has used MS Build for copying and moving large amounts files, you’ll know why I am using Gradle for this. I learned Gradle/Groovy since we are using Jenkins.

Some options:

  1. Have the class be compiled and put on the classpath: http://www.gradle.org/docs/current/userguide/organizing_build_logic.html#sec:build_sources 2. Write the class in a script, that you include using 'apply from: “path/to/script.gradle”

For #2, keep in mind that classloaders for scripts are isolated. This means you can use the class directly in the consumer script, but need some kind of indirection.

If you really want it to be a class, #1 is the simplest solution.