Groovy 1.0 was released on January 2, 2007, and Groovy 2.0 in July, 2012. Since version 2, Groovy can be compiled statically, offering type inference and performance near that of Java. Groovy 2.4 was the last major release under Pivotal Software’s sponsorship which ended in March 2015. Groovy 2.5.2 is the latest stable version of Groovy. Groovy has since changed its governance structure to a Project Management Committee in the Apache Software Foundation.
Simple examples on how to use Groovy to write your first scripts Groovy Console Example In this tutorial, I will show you how to use Groovy Console to run your Groovy scripts and also give you some details about Groovy Console itself. Actually, there are several ways to run Groovy scripts. You can run it on your favourite IDE, you can run it from command line, or you can use Groovy Console to run your scripts. Groovy Dictionary Example In this article we will see how to have a Dictionary in Groovy. Groovy does not have a built in dictionary like Python language. However we can use the Map data structure for manipulating a Dictionary. To understand this article, the reader should have a better understanding of how Map works in Groovy. You can read this Groovy-Map-Example for the same. Groovy Collections Example Apache Groovy (Groovy) is an object-oriented dynamic programming language for the Java platform. It is dynamically compiled to the Java Virtual Machine (JVM) bytecode, and inter-operates with other Java source codes and libraries. Groovy is written in Java and was first released in 2007. Groovy String Example String related manipulations have been always important in almost all programming languages. If you are using Groovy, you will do String manipulation in an easy way. In other words, it is very easy to split, add, manipulate, initialize, escape Strings in Groovy. In this tutorial I will show you how to use Groovy String efficiently. Groovy Substring Example Sometimes, the provided text may not be suitable for our needs. Because of this, we use string manipulation functions to convert it to desired format or extract specific part of it. You can hear this operation as substring operation in software development world. In this tutorial, I will show you how to apply substring operations on a given string. In Groovy, you can use several ways to extract specific part of a given string. Groovy Date Example Date operations may be painful in most of the programming languages. You may spend most of your time to convert dates from one format to another one. In Groovy, date operations are very easy. Groovy has lots of functions extended from JDK Date API, this allows us to use date related operations in an easier way. Let’s have a look at how can we use Groovy date extension. Groovy Closure Example A closure is an anonymous code block that can take arguments, return value, and also can be assigned to a variable. When it comes to Groovy, a closure can contain a variable scope defined outside of the closure expression. Groovy offers extended features to formal closure definition. Groovy Tutorials – Functions Learn the basic functionalities of Groovy Groovy List Example List is generally used as stack in software development world in order to push items in it for future use and to be able to fetch back in a desired way. In this tutorial, I will show you how to use Groovy list like a senior developer. I assume, you have already set up Groovy on local machine and executed Hello World project. So, let’s get started. Groovy Map Example In this tutorial, I will show you how to evaluate the power of Groovy maps. You will provided codes for each case and I assume that you have a little bit back ground about groovy. Let’s have a look at map concepts in groovy step by step together. Groovy Array Example In previous tutorials, we have mentioned about Groovy List and provided lots of examples. In this tutorial, I will show you how to use Groovy arrays. Even if array and list seems to be same, they have differences in common. For example, arrays have fixed size while lists have dynamic size that means you can add item as much as you can after initialization of the list. Groovy Each Example In this example, I will demonstrate how to use the Groovy each and eachWithIndex methods for various common object types in a Maven project. Groovy Collect Example Groovy collect() is used for iterate through collections to apply closure to each element. In this tutorial, we will see how to use collect() for collection operations. Groovy Regex Example Regular Expression is a character sequence defines search pattern especially for pattern matching with strings. You may see Regular Expression as Regex or Regexp in software world. In this tutorial, I will show you how to use regex operations in Groovy by using pretty easy methods. Groovy SQL Example Apache Groovy (Groovy) is an object-oriented dynamic programming language for the Java platform. It is dynamically compiled to the Java Virtual Machine (JVM) bytecode, and inter-operates with other Java source codes and libraries. Groovy is written in Java and was first released in 2007. Groovy SQL module provides a higher-level abstraction on JDBC technology. Groovy Json Example In this article we will see how to manipulate JSON data in Groovy. JSON (JavaScript Object Notation) is the much preferred data format these days for the exchange of data between the interested parties (client and server), due to its light weight nature and ease of use. Groovy Tutorials – Integrations Learn how to integrate your Groovy script with 3rd party frameworks Grails on Groovy Tutorial Grails is a web development framework integrated with JVM that lets developers to develop applications by using built-in features like integrated ORM, DSL (Domain Specific Languages), runtime and compile time meta programming, and concurrent programming. In this tutorial, I will show you how to develop Grails application step by step with extra theoretical informations about Grails. Working with sass scripts in Grails 2.3.X Sass is one of the most mature, stable, and powerful professional grade CSS extension language available. Before we can use Sass, we need to set it up on our project. In grails-2.4.X, it is very easy to use sass through asset pipeline plugin. But with grails-2.3.x version, we need to follow these steps: Fetching List of message codes from message.properties Normally messages from message properties are fetched via, key i.e. message code, What if we want to select more than one message property, like a list. To get a list of select message codes from message.properties, we need to customize messageSource bean. To do that, lets create a class ‘CustomisedPluginAwareResourceBundleMessageSource’ which should extend class ‘PluginAwareResourceBundleMessageSource’. Using Groovy scriptlets inside a *.docx document One of my recent projects required automated generation of contracts for customers. Contract is a legal document of about 10 pages length. One contract form can be applied for many customers so the document is a template with customer info put in certain places. In this article I am going to show you how I solved this problem.