Creating and Running Groovy Scripts in a Grails Application

Hi all,

I've just upgraded to the newest IntelliJ (7.0.3 EAP) and the installed the newest Groovy plugin. I've created an Grails Application, and I want to create a small Groovy script/class, and this is not possible: the Groovy option has disappeared from the 'New' menu (the Grails option is there, but I just want to create a Groovy script). In 7.0.2, with the 'older' version of the Groovy Plugin, this did work.

When I create a 'new file', and call it 'X.groovy', it is recognized as an Groovy file, but I cannot run it:

Information:Compilation completed with 7 errors and 0 warnings
Information:7 errors
Information:0 warnings
C:\Documents and Settings\Erik Pragt\.IntelliJIdea70\system\compiler\TestTestTest.TestTestTestd646e52d\.generated\Groovy_to_java_source_code_generator\TestTestTest.48926510\production\Config.java
Error:Error:line (1)package groovy.lang does not exist
C:\Documents and Settings\Erik Pragt\.IntelliJIdea70\system\compiler\TestTestTest.TestTestTestd646e52d\.generated\Groovy_to_java_source_code_generator\TestTestTest.48926510\production\Book.java
Error:Error:line (1)package groovy.lang does not exist
C:\Documents and Settings\Erik Pragt\.IntelliJIdea70\system\compiler\TestTestTest.TestTestTestd646e52d\.generated\Groovy_to_java_source_code_generator\TestTestTest.48926510\production\DataSource.java
Error:Error:line (1)package groovy.lang does not exist
C:\Documents and Settings\Erik Pragt\.IntelliJIdea70\system\compiler\TestTestTest.TestTestTestd646e52d\.generated\Groovy_to_java_source_code_generator\TestTestTest.48926510\production\BootStrap.java
Error:Error:line (1)package groovy.lang does not exist
C:\Documents and Settings\Erik Pragt\.IntelliJIdea70\system\compiler\TestTestTest.TestTestTestd646e52d\.generated\Groovy_to_java_source_code_generator\TestTestTest.48926510\production\X.java
Error:Error:line (1)package groovy.lang does not exist
C:\Documents and Settings\Erik Pragt\.IntelliJIdea70\system\compiler\TestTestTest.TestTestTestd646e52d\.generated\Groovy_to_java_source_code_generator\TestTestTest.48926510\production\UrlMappings.java
Error:Error:line (1)package groovy.lang does not exist
C:\Documents and Settings\Erik Pragt\.IntelliJIdea70\system\compiler\TestTestTest.TestTestTestd646e52d\.generated\Groovy_to_java_source_code_generator\TestTestTest.48926510\production\resources.java
Error:Error:line (1)package groovy.lang does not exist

Even though Groovy and Grails are added to the project (automatically), and the Facets are there too.

Grails also doesn't work btw!

0
Avatar
Permanently deleted user

If you have a plugin version 14201, then please update to the last version in plugin manager.

Eugene.

0
Avatar
Permanently deleted user

I had this problem too, you need to make sure that the GRAILS and GROOVY global libraries are listed in your Preferences->Project->Modules->Dependencies.

0

Ah, thanks! I didn't know (or I forgot) that you'd have to add them manually.

Eugene, is it possible to have them added automatically?

0
Avatar
Permanently deleted user

Yep, it was a stopship in 14201, now automatic addition is back.

0

PS: The 'Create new Groovy Script/Class' option is still missing, but upgrading to 1428 solved the other problem.

Update: I removed the Groovy library from the classpath (I kept Grails there), and now I can create new Groovy Script/Classes...

Message was edited by:
Erik Pragt

0

请先登录再写评论。