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. The library requires Groovy 1.6 and JScience 4.3.

Downloading The Library

Releases of the library may be downloaded from the Groovy-Measures Releases page.

Building The Library From Source

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

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

work $ cd groovy-measures/
groovy-measures $ gradle libs
:build/classes
:init
:resources
:compile
:testResources
:testCompile
:test
:archive_jar
:libs

BUILD SUCCESSFUL

Total time: 6.146 secs
groovy-measures $

Once the build is complete, the groovy-measures jar should be in the build/ directory at the top of the project.