I implemented some Production deployment logic with my own .groovy classes which I dropped under my gradle’s project buildSrc directory. I then rely on these classes in my build.gradle script, and therefore, specify “import…” statements for the classes I need in build.gradle
It works great if I keep the buildSrc directory. Gradle sees buildSrc, automatically compiles source files and puts compiled classes on the buildscript’s classpath.
However, I do not want compilation and tests to run in Production. Thus, I do not want to carry my buildSrc directory to Production environment but instead want to carry the .jar file with already compiled classes and have this .jar loaded into my buildscript’s classpath.
I already tried specifying this code in both settings.gradle and build.gradle file, but that does not do the trick.
classpath files (‘lib/myClasses.jar’)
When I try to run task that I defined in my build.gradle file, Gradle still complains about unknown imports at the top of my build.gradle script (which references classes found in myClasses.jar).
Does anyone know of a good solution here?