Articles

Sunday, 12 September 2010

GroovyDoc

Calling GroovyDoc from Ant

It is available in groovy-1.1-rc1 right in the core of groovy, call it from ant like this:

<taskdef name="Groovydoc" classname="org.codehaus.groovy.ant.Groovydoc">
   <classpath>
      <path path="${mainClassesDirectory}"/>
      <path refid="compilePath"/>
   </classpath>
</taskdef>

<Groovydoc 
      destdir="${docsDirectory}/gapi"
      sourcepath="${mainSourceDirectory}" 
      packagenames="**.*" use="true"
      windowtitle="Groovydoc" private="false"/>

Saturday, 11 September 2010

Getting Started with Groovy

Download | Documentation | Developers | Community | API
Getting Started guide |
SearchGroovy |

Groovy is a dynamically compiled object oriented language for the Java Virtual Machine (JVM).

Groovy features differentiating the language from Java 6 and earlier include:

Groovy as a dynamic language
A Groovy script is fully parsed, compiled, and generated before execution.  The process occurs under the hood, and the compiled version is not saved as an artifact of the process.


Maps

A map is used to store "associative arrays" or "dictionaries", an unordered collection of heterogeneous, named data.

For example, we want to store names and IQ scores:


scores = [ "Brett":100, "Pete":"Did not finish", "Andrew":86.87934 ]

Note that each of the values stored in the map is of a different type. Brett's is an integer, Pete's is a string, and Andrew's is a floating point number. We can access the values in a map in two main ways:

println scores["Pete"]
println scores.Pete