"package groovy.lang does not exist"

I downloaded the latest IDEA for Linux to try it out for editing Groovy scripts, but I've run into an immediate problem which I'm sure is trivial but I can't see what I'm doing wrong. I have a script 'page.groovy', and when I try to run it, a 'page.java' window pops up with the error message "package groovy.lang does not exist". I'm puzzled why this should be, as I've installed the JetGroovy plugin and configured Groovy, and I can see GROOVY as a global library when I look at the project settings.

I am a complete newbie to IDEA and JetGroovy, so it may be something simple I've missed. Keen to know what it is, though.

7 comments
Comment actions Permalink

I found what my problem was (or at least a way around it). I was able to compile and run the script OK after I went into the project settings and explicitly added 'groovy-all-1.5.6.jar' to the libraries for my project. I had assumed it would pick this up automatically as it's there in the Global Libraries area under Platform Settings when I go into the project settings. So, I assume for every Groovy project you need to add groovy-all-1.5.6.jar to the project itself, it's not enough to configure it globally.

1
Comment actions Permalink

Hi,

For starters, you should indicate the versions of the software you've installed, IDEA, JetGroovy, Groovy and JVM (plug-in version numbers are shown in the IDEA Plug-In settings module. You should also indicate your OS platform and hardware configuration.

Next you should say more about precisely what you did when you "tried to run it" and what precisely occurred when you did. E.g., are you launching the Groovy script from within IDEA, or from a command-line prompt?


Randall Schulz

0
Comment actions Permalink

Well, they're all the latest versions as of when I downloaded them yesterday. So, IDEA is version 7.0.3 (build 7757). JetGroovy is 1.5.16212. Groovy is version 1.5.6, JVM is 1.6.0_03-b05. The OS is Linux, specifically Kubuntu 7.10.

I tried to run it by selecting Run from the Run menu. What happened is that a new tab showing 'page.java' is opened (presumably showing an intermediate stage of the compile/run process). Then the messages pane at the bottom gives the message "Error:(1,37) package groovy.lang does not exist". The location of the error is the beginning of the 'page.java' file, namely:

public class page extends groovy.lang.Script {


It's certainly nothing to do with the Groovy script itself, which runs fine elsewhere. I tried a new script, consisting of a single println statement and got a similar error to the above. It looks to me as if IntelliJ is not quite configured for Groovy yet, but I'm wondering what I've missed.

0
Comment actions Permalink

This seems eminently proper behavior.

And if you'll recall, this was one of my original questions to you on the Groovy mailing list:

Did you enable the Groovy library resources for the module in which your
Groovy code resides?



Randall Schulz

0
Comment actions Permalink

That's fine, it's easy enough to remember to do. What, though, is the function of the 'Global libraries' setting, if it does not use these libraries in ones project?

0
Comment actions Permalink

I believe they're used when the JetGroovy plug-in code needs to execute Groovy or Grails code for its own purposes.


Randall Schulz

0
Comment actions Permalink

Note for Support team: The way the person replies here is completely unacceptable.

It is just a text book example of rudness and unwelcoming attitude bordering on incivility.

Big up, though, for the question author for figuring out the answer on their own

0

Please sign in to leave a comment.