Hi,

I am taking the opportunity to inform you of an issue we have seen since a long time.

When a @Grab statement is in a script, the next statement MUST be a variable statement. For example, a code like this:

@Grapes([

  @Grab('org.apache:commons-lang:2.6')

])

 

// this var declaration is required to avoid startup error

//def i = 0

 

println "test1"

 

println org.apache.commons.lang.WordUtils.capitalize("this is another test")

will fail like this:

groovy test.groovy

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:

/home/ldecloed/Groovy/workspace/issueGrabStatement/test.groovy: 8: unexpected token: println @ line 8, column 1.

   println "test1"

   ^

 

1 error

 

Although it works without problem if the ‘i’ variable declaration is uncommented.

Is it a known issue ?

 

Regards,

Loc

 

--

Loc Decloedt

CAD & Software Manager

eVaderis

eVaderis-logo-CMJN-small1

 

Minatec Entreprise BHT

7, Parvis Louis Nel

38054 Grenoble Cedex 9

France

Office : 04 38 7 80874