Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is Groovy knowledge required to understand Gradle?

Tags:

So, I've been trying to avoid build tools for a while, but started to use Gradle for some time now. I'm able to use it for simple things like letting it download dependencies, like it's intended, but I've seen people use it to do really advanced staff like manage large projects with different modules, native dependencies, publish to Github when building, etc.

I feel like I still need to copy-paste a lot when trying to do anything more complicated, because even after finding some documentation to read, I'm still not sure where language syntax like {, }, :, (, ), are meant to be used.

So, my question is: Does it make sense to learn Groovy to understand Gradle better? Should reading the docs be enough? I'm not even asking because I would not be interested in Groovy, I'm just wondering how people got used to using Gradle and whether it makes sense to use it for more advanced tasks then fetching dependencies from repositories.

like image 639
Silverclaw Avatar asked Jul 11 '16 20:07

Silverclaw


People also ask

Is Groovy required for Gradle?

gradle is a Groovy script. Thus it can execute arbitrary code and access any Java library, build-specific Gradle DSL and the Gradle API.

Is Gradle difficult to learn?

Gradle, the build automation tool for multi-language software development that is widely used for Android is notoriously difficult to use.

What is difference between Groovy and Gradle?

Gradle and Groovy are primarily classified as "Java Build" and "Languages" tools respectively. "Flexibility" is the primary reason why developers consider Gradle over the competitors, whereas "Java platform" was stated as the key factor in picking Groovy. Gradle and Groovy are both open source tools.

Which language is used in Gradle?

It is popular for its ability to build automation in languages like Java, Scala, Android, C/C++, and Groovy. The tool supports groovy based Domain Specific Language over XML. Gradle provides building, testing, and deploying software on several platforms.


1 Answers

Gradle uses DSL (domain specific language) that is currently based on top of Groovy. That means, that you should be able to work with Gradle to some extend by learning the DSL only. It, of course, inherits some of the syntax from Groovy (like the parentheses etc) but the syntax pretty far away from a normal Groovy code.

If you want to start writing your own closures, tasks and plugins then you need some Groovy skills, yes. Groovy in Action 2nd edition is a great book, or if you are a Java developer, take a look at Making Java Groovy.

Saying that, please keep in mind that Gradle Inc announced that they are going to support Kotlin as another language to base the DSL on. It means that you will be able to write the "custom" parts of your build in Kotlin or Groovy. So, keep an eye on Kotlin as well, here's the best way to do it – Kotlin in Action.

like image 102
JBaruch Avatar answered Oct 04 '22 16:10

JBaruch