Groovy is an object-oriented programming language for the Java platform. It is a dynamic language with features similar to those of Python, Ruby, Perl, and Smalltalk. It can be used as a scripting language for the Java Platform, is dynamically compiled to Java Virtual Machine (JVM) bytecode, and interoperates with other Java code and libraries. Groovy uses a Java-like curly-bracket syntax. Most Java code is also syntactically valid Groovy, although semantics may be different.
Groovy 1.0 was released on January 2, 2007, and Groovy 2.0 in July, 2012. Groovy 3.0 is planned for release in late 2015, with support for a new Meta Object Protocol.[2] Since version 2, Groovy can also be compiled statically, offering type inference and performance very close to that of Java.[3][4] Groovy 2.4 was the last major release under Pivotal Software's sponsorship which ended in March 2015.[5]
A few current facts summarize from groovy official site.
- current version 2.4
- gradle and maven support
- source code available? Yes!
- coding in ide? Yes!
- parsing and process json capability
- processing xml
- working with jmx
- groovy server pages
- as a template engines
- closures
Because it is script and interpreted by jvm, so you need to watch out for jvm that run groovy. Below is the table.
Groovy Branch JVM Required (non-indy) JVM Required (indy) *
2.3 - current 1.6 1.7
2.0 - 2.2 1.5 1.7
1.6 - 1.8 1.5 N/A
1.0 - 1.5 1.4 N/A
Okay, let's start with groovy hello world. Groovy provides three quick way to show "hello world" application. You can do it via groovy console, or groovy script or groovy shell.
1: $ cat hello.groovy
2: #!/usr/bin/env groovy
3:
4: println "Hello world!"
5: $ groovy hello.groovy
6: Hello world!
$ groovyConsole
1: $ groovysh
2: Groovy Shell (1.8.6, JVM: 1.7.0_55)
3: Type 'help' or '\h' for help.
4: ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
5: groovy:000> println "hello world"
6: hello world
7: ===> null
8: groovy:000>
So that's it, if you want to learn more about groovy, here are a few FAQ and its helpful links.
how much does it different than java?
http://www.groovy-lang.org/differences.html
gimme a few example?
http://www.groovy-lang.org/groovy-dev-kit.html
show me the syntax?
http://www.groovy-lang.org/syntax.html
operator?
http://www.groovy-lang.org/operators.html
groovy compiler?
http://www.groovy-lang.org/groovyc.html
groovy shell?
http://www.groovy-lang.org/groovysh.html
groovy console?
http://www.groovy-lang.org/groovyconsole.html