Skip to content
jeffbrown edited this page Sep 13, 2010 · 13 revisions

Introduction

The groovy-measures library aims to bring a DSL to groovy specifically for dealing with units of measure. For example, groovy-measures supports code like the following:


def distance = 9.meters + 34.centimeters

Using The Library

To use the groovy-measures library you must include the groovy-measures jar file in your application’s CLASSPATH and you must bootstrap the environment by loading the com.g2one.groovy.measures.GroovyMeasures class.


Class.forName 'com.g2one.groovy.measures.GroovyMeasures'

The library makes extensive use of JScience so the JScience jar file must also be on your application’s CLASSPATH.

Building The Library

The project is built using Gant. Check the project out using Git and then use Gant to build the jar file. See the following:

work $ git clone git://github.com/jeffbrown/groovy-measures.git
Initialized empty Git repository in /Users/jeff/work/groovy-measures/.git/
...

work $ cd groovy-measures/
groovy-measures $ gant jar
...
      [jar] Building jar: /Users/jeff/work/groovy-measures/build/groovy-measures_0.1-SNAPSHOT.jar
groovy-measures $ 
Clone this wiki locally