5 ms·
As someone tasked with supporting build and release automation in a large company using Gradle, it's never been enough to learn just enough Gradle and Groovy to
by devnull255 6y ago
As someone tasked with supporting build and release automation in a large company using Gradle, it's never been enough to learn just enough Gradle and Groovy to build any project, because I learned in a relatively short time that there's no end to all the ways something won't build because of what I didn't know about Gradle or Groovy for a particular build scenario. I also didn't expect to see how a gradle process might behave differently in a Jenkins pipeline job from how it behaves when you run a build interactively at the command line. And least but not last, who would have thought how much of a headache it might be figuring out why an IDE with a Gradle plugin built a project just fine while building with Gradle on the command line or in Jenkins failed.
Some of the issues I eventually figured out had to do with missing or incomplete documentation explaining some of the caveats or gotchas of Gradle constructs that one might assume should work the same way. For example, the use of old-style vs new-style code for plugins (buildscript/apply plugin vs. plugin DSL) is not always interchangeable. The new-style works at the top-level of multiproject builds but one must use the old apply plugin form in subprojects.
We've had to use Gradle to build non-java projects as well, which need to use Exec and Copy tasks to build and stage build artifacts. However, the Copy tasks, which are usually dependent on the Exec build tasks, don't always execute after the tasks they are dependent on have completed. Or rather, a Gradle project built on the command line will successfully respect those dependencies while a Jenkins job will output NO-SOURCE in the task execution step.
The problem with Gradle is that it is not as simple as Make, which I had to use in a prior position. However, successful use of Gradle does require significant more investment in learning more than you first think you might need to know about Gradle in a tutorial. It also requires significant investment in learning about Groovy, which will help illuminate how the Gradle DSL works.