Groovy 1.7.9

groovy.lang
[Java] Annotation Type Grab

java.lang.Object
  groovy.lang.Grab

@Retention(RetentionPolicy.SOURCE)
@Target({
        ElementType.CONSTRUCTOR,
        ElementType.FIELD,
        ElementType.LOCAL_VARIABLE,
        ElementType.METHOD,
        ElementType.PARAMETER,
        ElementType.TYPE})
public @interface Grab

Used to grab the referenced artifact and its dependencies and make it available on the Classpath.

Some examples:

 @Grab(group='commons-lang', module='commons-lang', version='2.4')
 import org.apache.commons.lang.WordUtils
 println "Hello ${WordUtils.capitalize('world')}"
 
Or using the compact Gradle-inspired syntax:
 @Grab('commons-lang:commons-lang:2.4')
 import org.apache.commons.lang.WordUtils
 println "Hello ${WordUtils.capitalize('world')}"
 
or the same thing again using the Ivy-inspired syntax variant:
 @Grab('commons-lang#commons-lang;2.4')
 import org.apache.commons.lang.WordUtils
 println "Hello ${WordUtils.capitalize('world')}"
 


Method Summary
 
Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
 

Copyright © 2003-2010 The Codehaus. All rights reserved.