Could not find the main class: org.codehaus.groovy.tools.GroovyStarter

Hello folks,

I'm trying to debug a GroovyScript within a Grails app.  I setup what seems to be a reasonable debug profile for the script.  I tried debug and Intellij let me know that I needed to configure Groovy.  Ok, so I add Groovy 1.0.4 as a library to the project (not sure why it doesn't use GROOVY_HOME).  Clicking on debug again yields:

java.lang.NoClassDefFoundError: org/codehaus/groovy/tools/GroovyStarter

Then I notice a few settings that don't look right:

-Dgroovy.home=C:\grails\grails-1.0.4 -Dgroovy.starter.confC:\grails\grails-1.0.4/conf/groovy-starter.conf

How do I change these values?  I looked all over for a config page for the JetGroovy Plugin.

Thanks!
Daniel

0
8 comments

Please, try the last build IDEA

0
Avatar
Permanently deleted user

I am using 8.0.1

Where do I get the latest build?

0
Avatar
Permanently deleted user

You may last EAP (further IDEA 8.1) from http://jetbrains.net/confluence/display/IDEADEV/Diana+EAP

Kind regards,
Ilya

0
Avatar
Permanently deleted user

I'm now using Diana build #9684.  I still see the same issue when trying to debug a GroovyScript:

java.lang.NoClassDefFoundError: org/codehaus/groovy/tools/GroovyStarter

Where can I change the settings -Dgroovy.home=C:\grails\grails-1.0.4 -Dgroovy.starter.conf=C:\grails\grails-1.0.4/conf/groovy-starter.conf?

Shouldn't groovy.home=c:\groovy\groovy-1.6-RC-1 instead?  It seems that I've somehow set the base dir for groovy to be that of grails.
How do I change this setting?  Why doesn't JetGroovy use the GROOVY_HOME and GRAILS_HOME env variables?

Regards,
Daniel

0

These settings seem correct to me, at least, groovy script runs
perfectly for me in a Grails application with Grails SDK. Where is your
script located in the application structure? Could you post the whole
command line with complete classpath?

0
Avatar
Permanently deleted user

I have attached a screenshot.

I am trying to execute the script ImportRunner and pass it two arguments, the name of another groovy script (CategoryImporter) and the path of some xml (c:\import\categories).
Both scripts reside in the working directory c:\projects\Grailsamundo\scripts.  I have confidence in these settings because that is how the execute the script from the command line.

The only thing that is different when I execute the script from the command line is GROOVY_HOME=c:\groovy\groovy-1.6-RC-1

Regards,
Daniel



Attachment(s):
debug_settings.png
0

Thank you. The whole command line can be copied from run console, it's
there just before the exception you've reported. But I think I can
figure out the problem. Seems that when IDEA sees that you've defined
'-classpath' setting in your run configuration, it doesn't do it by
itself, and so the needed jar isn't included there. Why do you need to
specify classpath on your own, why can't you just include the mentioned
jar in your module dependencies, and leave the VM parameters blank? The
jar will be added to --classpath and its classes will be available to
your script at runtime.

0
Avatar
Permanently deleted user

Awesome, that worked.  Thanks!

0

Please sign in to leave a comment.