This page is no longer maintained — Please continue to the home page at www.scala-lang.org

RE: problem importing Groovy

3 replies
Marune
Joined: 2008-10-01,
User offline. Last seen 3 years 20 weeks ago.
.hmmessage P { margin:0px; padding:0px } body.hmmessage { font-size: 10pt; font-family:Verdana }
Of course, that works fine.
I have double-checked my NetBeans project files for any discrepancy between the groovy jar and the others, but nothing.
Hmm..
> Date: Thu, 26 Feb 2009 00:06:26 +0000
> From: jon.pretty@sygneca.com
> To: skeptic2000@hotmail.com
> CC: scala-user@listes.epfl.ch
> Subject: Re: [scala-user] problem importing Groovy
>
> Hi,
>
> Skeptic 2000 wrote:
>> I'm trying to experiment a Scala-Groovy combo (Scala code will call
>> Groovy scripts).
>
> Clearly something's amiss with the classpath...
>
> What happens if you type:
>
> scalac -cp path/to/groovy.jar path/to/your/file.scala
>
> (or the equivalent for your OS)?
>
> Jon
>
> --
> Jon Pretty | Sygneca Ltd.
>


Steve Bendiola
Joined: 2008-12-27,
User offline. Last seen 42 years 45 weeks ago.
Re: problem importing Groovy

When you build does it say successful in the output? For me this
builds and runs, the ide flags the import "not found: value groovy",
but i can run it.

package foo
import groovy.lang.GroovyShell

object ScalaCallingGroovy extends Application {
println("running groovy main")
new GroovyShell();
println("ran groovy main")
}

init:
deps-jar:
Compiling 1 source file to /Users/sbendiola/libs/wgroovy/build/classes
compile:
run:
running groovy main
ran groovy main
BUILD SUCCESSFUL (total time: 4 seconds)

On Wed, Feb 25, 2009 at 6:56 PM, Skeptic 2000 wrote:
>
> Of course, that works fine.
> I have double-checked my NetBeans project files for any discrepancy between
> the groovy jar and the others, but nothing.
> Hmm..
>> Date: Thu, 26 Feb 2009 00:06:26 +0000
>> From: jon.pretty@sygneca.com
>> To: skeptic2000@hotmail.com
>> CC: scala-user@listes.epfl.ch
>> Subject: Re: [scala-user] problem importing Groovy
>>
>> Hi,
>>
>> Skeptic 2000 wrote:
>>> I'm trying to experiment a Scala-Groovy combo (Scala code will call
>>> Groovy scripts).
>>
>> Clearly something's amiss with the classpath...
>>
>> What happens if you type:
>>
>> scalac -cp path/to/groovy.jar path/to/your/file.scala
>>
>> (or the equivalent for your OS)?
>>
>> Jon
>>
>> --
>> Jon Pretty | Sygneca Ltd.
>>
>
> ________________________________
> ________________________________

Marune
Joined: 2008-10-01,
User offline. Last seen 3 years 20 weeks ago.
RE: problem importing Groovy
.hmmessage P { margin:0px; padding:0px } body.hmmessage { font-size: 10pt; font-family:Verdana }

Thanks,
My problem was caused by 1) the IDE/plugins lying to me like you said and 2) I tought that doing : import groovy._ would import classes in sub-packages (like groovy.util.GroovyScriptEngine.

> Date: Wed, 25 Feb 2009 22:02:44 -0600
> Subject: Re: [scala-user] problem importing Groovy
> From: steve.bendiola@gmail.com
> To: skeptic2000@hotmail.com
> CC: scala-user@listes.epfl.ch
>
> When you build does it say successful in the output? For me this
> builds and runs, the ide flags the import "not found: value groovy",
> but i can run it.
>
> package foo
> import groovy.lang.GroovyShell
>
> object ScalaCallingGroovy extends Application {
> println("running groovy main")
> new GroovyShell();
> println("ran groovy main")
> }
>
> init:
> deps-jar:
> Compiling 1 source file to /Users/sbendiola/libs/wgroovy/build/classes
> compile:
> run:
> running groovy main
> ran groovy main
> BUILD SUCCESSFUL (total time: 4 seconds)
>
>
> On Wed, Feb 25, 2009 at 6:56 PM, Skeptic 2000 <skeptic2000@hotmail.com> wrote:
>>
>> Of course, that works fine.
>> I have double-checked my NetBeans project files for any discrepancy between
>> the groovy jar and the others, but nothing.
>> Hmm..
>>> Date: Thu, 26 Feb 2009 00:06:26 +0000
>>> From: jon.pretty@sygneca.com
>>> To: skeptic2000@hotmail.com
>>> CC: scala-user@listes.epfl.ch
>>> Subject: Re: [scala-user] problem importing Groovy
>>>
>>> Hi,
>>>
>>> Skeptic 2000 wrote:
>>>> I'm trying to experiment a Scala-Groovy combo (Scala code will call
>>>> Groovy scripts).
>>>
>>> Clearly something's amiss with the classpath...
>>>
>>> What happens if you type:
>>>
>>> scalac -cp path/to/groovy.jar path/to/your/file.scala
>>>
>>> (or the equivalent for your OS)?
>>>
>>> Jon
>>>
>>> --
>>> Jon Pretty | Sygneca Ltd.
>>>
>>
>> ________________________________
>> ________________________________

Ricky Clarkson
Joined: 2008-12-19,
User offline. Last seen 3 years 2 weeks ago.
Re: problem importing Groovy
For now you might want to exit the IDE to get stuff done.

ricky@ricky-desktop:~$ scala -classpath ~/.m2/repository/org/codehaus/groovy/groovy-all/1.1-beta-2/groovy-all-1.1-beta-2.jar
Welcome to Scala version 2.8.0.r17201-b20090225091832 (Java HotSpot(TM) Client VM, Java 1.6.0_11).
Type in expressions to have them evaluated.
Type :help for more information.

scala> import groovy._
import groovy._

2009/2/26 Skeptic 2000 <skeptic2000@hotmail.com>


Thanks,
My problem was caused by 1) the IDE/plugins lying to me like you said and 2) I tought that doing : import groovy._ would import classes in sub-packages (like groovy.util.GroovyScriptEngine.

> Date: Wed, 25 Feb 2009 22:02:44 -0600
> Subject: Re: [scala-user] problem importing Groovy
> From: steve.bendiola@gmail.com
> To: skeptic2000@hotmail.com
> CC: scala-user@listes.epfl.ch
>
> When you build does it say successful in the output? For me this
> builds and runs, the ide flags the import "not found: value groovy",
> but i can run it.
>
> package foo
> import groovy.lang.GroovyShell
>
> object ScalaCallingGroovy extends Application {
> println("running groovy main")
> new GroovyShell();
> println("ran groovy main")
> }
>
> init:
> deps-jar:
> Compiling 1 source file to /Users/sbendiola/libs/wgroovy/build/classes
> compile:
> run:
> running groovy main
> ran groovy main
> BUILD SUCCESSFUL (total time: 4 seconds)
>
>
> On Wed, Feb 25, 2009 at 6:56 PM, Skeptic 2000 <skeptic2000@hotmail.com> wrote:
>>
>> Of course, that works fine.
>> I have double-checked my NetBeans project files for any discrepancy between
>> the groovy jar and the others, but nothing.
>> Hmm..
>>> Date: Thu, 26 Feb 2009 00:06:26 +0000
>>> From: jon.pretty@sygneca.com
>>> To: skeptic2000@hotmail.com
>>> CC: scala-user@listes.epfl.ch
>>> Subject: Re: [scala-user] problem importing Groovy
>>>
>>> Hi,
>>>
>>> Skeptic 2000 wrote:
>>>> I'm trying to experiment a Scala-Groovy combo (Scala code will call
>>>> Groovy scripts).
>>>
>>> Clearly something's amiss with the classpath...
>>>
>>> What happens if you type:
>>>
>>> scalac -cp path/to/groovy.jar path/to/your/file.scala
>>>
>>> (or the equivalent for your OS)?
>>>
>>> Jon
>>>
>>> --
>>> Jon Pretty | Sygneca Ltd.
>>>
>>
>> ________________________________
>> ________________________________


Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland