groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From DECLOEDT Loic EVADERIS <Loic.DECLO...@cea.fr>
Subject groovy issue with @Grab
Date Wed, 23 Mar 2016 09:08:03 GMT
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,
Loïc

--
Loïc Decloedt
CAD & Software Manager
eVaderis
[eVaderis-logo-CMJN-small1]

Minatec Entreprise BHT
7, Parvis Louis Néel
38054 Grenoble Cedex 9
France
Office : 04 38 7 80874


Mime
View raw message