Unable to run groovy script that uses classes.

Hi

I'm unable to run a groovy script that uses classes from the same module.
So, I created a simple test project from scratch to try to figure out what's wrong, but I can't find what's the problem.

So, here is the groovy script:

import somepackage.A
import somepackage.C

new A()
new B()
new C()
new D()


The classes of course all exist. C and D are Java classes, A and B are groovy classes. D and B are not located in any package.

So, if I try to run this script via Intellij Idea I get the following console output:

/usr/lib/jvm/java-6-sun/bin/java -Dgroovy.home=/home/elmar/groovy-1.6.3 -Dgroovy.starter.conf=/home/elmar/groovy-1.6.3/conf/groovy-starter.conf -Dtools.jar=/usr/lib/jvm/java-6-sun/lib/tools.jar -Didea.launcher.port=7535 -Didea.launcher.bin.path=/home/elmar/idea-10313/bin -Dfile.encoding=UTF-8 -classpath /home/elmar/groovy-1.6.3/embeddable/groovy-all-1.6.3.jar:/home/elmar/idea-10313/lib/idea_rt.jar com.intellij.rt.execution.application.AppMain org.codehaus.groovy.tools.GroovyStarter --main groovy.ui.GroovyMain --conf /home/elmar/groovy-1.6.3/conf/groovy-starter.conf --classpath "/home/elmar/IdeaProjects/testgroovy/out/production/testgroovy:/home/elmar/groovy-1.6.3/lib/ant-junit-1.7.1.jar:/home/elmar/groovy-1.6.3/lib/junit-3.8.2.jar:/home/elmar/groovy-1.6.3/lib/commons-logging-1.1.jar:/home/elmar/groovy-1.6.3/lib/xstream-1.3.jar:/home/elmar/groovy-1.6.3/lib/asm-analysis-2.2.3.jar:/home/elmar/groovy-1.6.3/lib/commons-cli-1.2.jar:/home/elmar/groovy-1.6.3/lib/asm-2.2.3.jar:/home/elmar/groovy-1.6.3/lib/ant-launcher-1.7.1.jar:/home/elmar/groovy-1.6.3/lib/asm-tree-2.2.3.jar:/home/elmar/groovy-1.6.3/lib/jline-0.9.94.jar:/home/elmar/groovy-1.6.3/lib/asm-util-2.2.3.jar:/home/elmar/groovy-1.6.3/lib/ivy-2.0.0.jar:/home/elmar/groovy-1.6.3/lib/bsf-2.4.0.jar:/home/elmar/groovy-1.6.3/lib/antlr-2.7.7.jar:/home/elmar/groovy-1.6.3/lib/jsp-api-2.0.jar:/home/elmar/groovy-1.6.3/lib/servlet-api-2.4.jar:/home/elmar/groovy-1.6.3/lib/ant-1.7.1.jar:" /home/elmar/IdeaProjects/testgroovy/src/starter.groovy
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, /home/elmar/IdeaProjects/testgroovy/src/starter.groovy: 1: unable to resolve class somepackage.A
@ line 1, column 1.
   import somepackage.A
   ^
/home/elmar/IdeaProjects/testgroovy/src/starter.groovy: 2: unable to resolve class somepackage.C
@ line 2, column 1.
   import somepackage.C
   ^
/home/elmar/IdeaProjects/testgroovy/src/starter.groovy: 5: unable to resolve class B
@ line 5, column 1.
   new B()
   ^
/home/elmar/IdeaProjects/testgroovy/src/starter.groovy: 7: unable to resolve class D
@ line 7, column 1.
   new D()
   ^

4 errors


Process finished with exit code 1


Obviously tha classes can not be found.

If I compile the java classes manually and rum the command from the console output the script runs without any error. And if I cd into the src directory and run "groovy starter.groovy" the script runs as expected, too (i.e. without any error).

This problem occurs both with Intellij Idea 8.1.2 and Maia #10313.

Groovy Version is 1.6.3
Java Version is 1.6.0_13
Operating System is Linux.

I attached the testproject.

Any help is appreciated.

Thanks in advance.



Attachment(s):
testgroovy.zip
5 comments
Comment actions Permalink

In your project, the 'make before run' option is unchecked for your
script run configuration. Please enable it and try again.

0
Comment actions Permalink

Hi

I tried to start it both with "make before launch" enabled and disabled. Same results.


Is this just a problem that occurs for me, or is this just such an unusal usage that no one else discovered this issue before?

0
Comment actions Permalink

Is this just a problem that occurs for me, or is this just such an unusal usage that no one else discovered this issue before?

Not only for you, there's a JIRA issue:
http://www.jetbrains.net/jira/browse/GRVY-2229.

Unfortunately we cannot reproduce it yet.

0
Comment actions Permalink

Ok, according to JIRA you've been able to reproduce and particulary fix the issue. So I'll just wait for 8.1.3 and this problem will be solved.

Thank you so far!

0
Comment actions Permalink

I had this problem with a scratch file.  I resolved it by adding the module containing the missing classes to the run configuration.

0

Please sign in to leave a comment.