Grails Module Classpath in run-app?
Hello,
I am using IDEA 8.1.3 build #9886 with its bundled JetGroovy plugin v8.0, with Grails release 1.1.1. I created a Grails module along with existing Java modules, and configured Grails module to depend on Java modules inside IDEA.
Compilation inside IDEA was fine, until I try to Run Grails module as a Grails Application (run-app), then it stopped at groovyc step when compiling the Java classes. Seems the Java modules jars are not in classpath. What steps are necessary to make that happen? Or must I write an ant script to manually copy all Java modules' jars to the "lib" directory? I figure IDEA should be smarter than that. Thank you for the help.
/opt/jdk1.6.0_14/bin/java -Dserver.host=localhost -Dserver.port=8080 -Denable.jndi=false -Ddisable.auto.recompile=false -Drecompile.frequency=3 -Xmx256M -Dgrails.home=/opt/grails-1.1.1 -Dbase.dir=/home/alex/bzr/server/work/app/www -Dtools.jar=/opt/jdk1.6.0_14/lib/tools.jar -Dgroovy.starter.conf=/opt/grails-1.1.1/conf/groovy-starter.conf -Didea.launcher.port=7536 -Didea.launcher.bin.path=/opt/idea-9732/bin -Dfile.encoding=UTF-8 -classpath /opt/grails-1.1.1/lib/groovy-all-1.6.3.jar:/opt/grails-1.1.1/dist/grails-bootstrap-1.1.1.jar:/opt/idea-9732/lib/idea_rt.jar com.intellij.rt.execution.application.AppMain org.codehaus.groovy.grails.cli.support.GrailsStarter --main org.codehaus.groovy.grails.cli.GrailsScriptRunner --conf /opt/grails-1.1.1/conf/groovy-starter.conf --classpath /opt/grails-1.1.1/lib/groovy-all-1.6.3.jar:.:/opt/grails-1.1.1/dist/grails-bootstrap-1.1.1.jar run-app
Welcome to Grails 1.1.1 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: /opt/grails-1.1.1
Base Directory: /home/alex/bzr/server/work/app/www
Running script /opt/grails-1.1.1/scripts/RunApp.groovy
Environment set to development
[groovyc] Compiling 1 source file to /home/alex/.grails/1.1.1/projects/www/classes
[groovyc] org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, Compile error during compilation with javac.
[groovyc] /home/alex/bzr/server/work/app/www/src/java/com/booyah/www/WwwModule.java:3: package com.booyah.core does not exist
[groovyc] import com.booyah.core.Module;
[groovyc] ^
[groovyc] /home/alex/bzr/server/work/app/www/src/java/com/booyah/www/WwwModule.java:8: cannot find symbol
[groovyc] symbol: class Module
[groovyc] public class WwwModule extends Module {
[groovyc] ^
[groovyc] /home/alex/bzr/server/work/app/www/src/java/com/booyah/www/WwwModule.java:10: cannot find symbol
[groovyc] symbol : class Module
[groovyc] location: class com.booyah.www.WwwModule
[groovyc] public Module[] getDependents() {
[groovyc] ^
[groovyc] /home/alex/bzr/server/work/app/www/src/java/com/booyah/www/WwwModule.java:11: cannot find symbol
[groovyc] symbol : class Module
[groovyc] location: class com.booyah.www.WwwModule
[groovyc] return new Module[0]; // TODO: change
[groovyc] ^
[groovyc] /home/alex/bzr/server/work/app/www/src/java/com/booyah/www/WwwModule.java:9: method does not override or implement a method from a supertype
[groovyc] @Override
[groovyc] ^
[groovyc] /home/alex/bzr/server/work/app/www/src/java/com/booyah/www/WwwModule.java:14: method does not override or implement a method from a supertype
[groovyc] @Override
[groovyc] ^
[groovyc] 6 errors
[groovyc]
[groovyc]
[groovyc] 1 error
Compilation error: Compilation Failed
Process finished with exit code 1
请先登录再写评论。
Please go to Run Configurations dialog, add a Grails application run
configuration there and specify your Grails module in it. Then hit run.
The classpath should be formed correctly.
'Run Grails Target' in 8.1.3 runs Grails as if it was invoked from
command line. It's an open question, if this is correct. Probably this
will be changed in IDEA 9.
Nope, I tried both 8.1.3 and 9 EAP 10558, with a very simple project: one Grails Module with one Java Module.
In Run Configurations, I selected the Grails Module, but the run-app target still runs with out the Java Module's jar in classpath.I have the screenshot from 9 EAP attached here.
/opt/jdk1.6.0_14/bin/java -Xmx256M -Dgrails.home=/opt/grails-1.1.1 -Dbase.dir=/home/alex/projects/temp -Dtools.jar=/opt/jdk1.6.0_14/lib/tools.jar -Dgroovy.starter.conf=/opt/grails-1.1.1/conf/groovy-starter.conf -Didea.launcher.port=7534 -Didea.launcher.bin.path=/opt/idea-10558/bin -Dfile.encoding=UTF-8 -classpath /opt/grails-1.1.1/lib/groovy-all-1.6.3.jar:/opt/grails-1.1.1/dist/grails-bootstrap-1.1.1.jar:/opt/idea-10558/lib/idea_rt.jar com.intellij.rt.execution.application.AppMain org.codehaus.groovy.grails.cli.support.GrailsStarter --main org.codehaus.groovy.grails.cli.GrailsScriptRunner --conf /opt/grails-1.1.1/conf/groovy-starter.conf --classpath /opt/grails-1.1.1/lib/groovy-all-1.6.3.jar:/opt/grails-1.1.1/dist/grails-webflow-1.1.1.jar:/opt/grails-1.1.1/lib/org.springframework.js-2.0.3.RELEASE.jar:/opt/grails-1.1.1/lib/oro-2.0.8.jar:/opt/grails-1.1.1/lib/jetty-6.1.14.jar:/opt/grails-1.1.1/dist/grails-web-1.1.1.jar:/opt/grails-1.1.1/lib/jta-1.1.jar:/opt/grails-1.1.1/lib/commons-lang-2.4.jar:/opt/grails-1.1.1/lib/jstl-2.4.jar:/opt/grails-1.1.1/dist/grails-resources-1.1.1.jar:/opt/grails-1.1.1/lib/junit-3.8.2.jar:/opt/grails-1.1.1/lib/org.springframework.webflow-2.0.3.RELEASE.jar:/opt/grails-1.1.1/lib/standard-2.4.jar:/opt/grails-1.1.1/lib/standard-2.3.jar:/opt/grails-1.1.1/lib/jcl-over-slf4j-1.5.6.jar:/opt/grails-1.1.1/lib/backport-util-concurrent-3.0.jar:/opt/grails-1.1.1/lib/slf4j-log4j12-1.5.6.jar:/opt/grails-1.1.1/lib/ejb3-persistence-3.3.0.jar:/opt/grails-1.1.1/dist/grails-bootstrap-1.1.1.jar:/opt/grails-1.1.1/lib/slf4j-api-1.5.6.jar:/opt/grails-1.1.1/lib/commons-fileupload-1.2.1.jar:/opt/grails-1.1.1/lib/commons-io-1.4.jar:/opt/grails-1.1.1/lib/jsp-api-2.1.jar:/opt/grails-1.1.1/lib/sitemesh-2.4.jar:/opt/grails-1.1.1/lib/jstl-2.3.jar:/opt/grails-1.1.1/lib/commons-codec-1.3.jar:/opt/grails-1.1.1/lib/jasper-compiler-5.5.15.jar:/opt/grails-1.1.1/lib/ant-nodeps-1.7.0.jar:/opt/grails-1.1.1/lib/commons-cli-1.0.jar:/opt/grails-1.1.1/lib/ant-launcher-1.7.0.jar:/opt/grails-1.1.1/lib/oscache-2.4.1.jar:/opt/grails-1.1.1/dist/grails-crud-1.1.1.jar:/opt/grails-1.1.1/lib/commons-beanutils-1.7.0.jar:/opt/grails-1.1.1/lib/log4j-1.2.15.jar:/opt/grails-1.1.1/lib/serializer.jar:/opt/grails-1.1.1/lib/hsqldb-1.8.0.5.jar:/opt/grails-1.1.1/lib/commons-pool-1.2.jar:/opt/grails-1.1.1/lib/jline-0.9.91.jar:/opt/grails-1.1.1/lib/svnkit-1.2.0.jar:/opt/grails-1.1.1/lib/jsr107cache-1.0.jar:/opt/grails-1.1.1/lib/org.springframework.binding-2.0.3.RELEASE.jar:/opt/grails-1.1.1/lib/jetty-util-6.1.14.jar:/opt/grails-1.1.1/lib/jsp-api-2.0.jar:/opt/grails-1.1.1/lib/start.jar:/opt/grails-1.1.1/lib/spring-2.5.6.jar:/opt/grails-1.1.1/lib/jasper-compiler-jdt-5.5.15.jar:/opt/grails-1.1.1/lib/ognl-2.6.9.jar:/opt/grails-1.1.1/lib/commons-collections-3.2.jar:/opt/grails-1.1.1/lib/xpp3_min-1.1.3.4.O.jar:/opt/grails-1.1.1/lib/jetty-naming-6.1.14.jar:/opt/grails-1.1.1/dist/grails-spring-1.1.1.jar:/opt/grails-1.1.1/lib/gant_groovy1.6-1.6.0.jar:/opt/grails-1.1.1/lib/spring-test-2.5.6.jar:/opt/grails-1.1.1/lib/ant-junit-1.7.0.jar:/opt/grails-1.1.1/lib/cglib-nodep-2.1_3.jar:/opt/grails-1.1.1/dist/grails-gorm-1.1.1.jar:/opt/grails-1.1.1/lib/commons-dbcp-1.2.1.jar:/opt/grails-1.1.1/lib/ant-1.7.0.jar:/opt/grails-1.1.1/dist/grails-scripts-1.1.1.jar:/opt/grails-1.1.1/dist/grails-test-1.1.1.jar:/opt/grails-1.1.1/lib/commons-validator-1.3.0.jar:/opt/grails-1.1.1/lib/commons-el-1.0.jar:/opt/grails-1.1.1/lib/ant-trax.jar:/opt/grails-1.1.1/dist/grails-core-1.1.1.jar:/opt/grails-1.1.1/lib/antlr-2.7.6.jar:/opt/grails-1.1.1/lib/spring-webmvc-2.5.6.jar:/opt/grails-1.1.1/lib/jetty-plus-6.1.14.jar:/opt/grails-1.1.1/lib/jasper-runtime-5.5.15.jar:/opt/grails-1.1.1/lib/ivy-2.0.0.jar:/opt/grails-1.1.1/lib/servlet-api-2.5-6.1.14.jar:/opt/grails-1.1.1/lib/ehcache-1.5.0.jar run-app
Welcome to Grails 1.1.1 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: /opt/grails-1.1.1
Base Directory: /home/alex/projects/temp
Running script /opt/grails-1.1.1/scripts/RunApp.groovy
Environment set to development
[groovyc] Compiling 7 source files to /home/alex/.grails/1.1.1/projects/temp/classes
[groovyc] org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, Compile error during compilation with javac.
[groovyc] /home/alex/projects/temp/src/java/test/Child.java:10: cannot find symbol
[groovyc] symbol: class Super
[groovyc] public class Child extends Super {
[groovyc] ^
[groovyc] /home/alex/projects/temp/src/java/test/Child.java:11: method does not override or implement a method from a supertype
[groovyc] @Override
[groovyc] ^
[groovyc] 2 errors
[groovyc]
[groovyc]
[groovyc] 1 error
Compilation error: Compilation Failed
Attachment(s):
grails.png
Thank you. The next Maia EAP should contain the fix.
Thanks a lot. Though is it possible to get a fix for IDEA 8.1.x version? We have purchased many IDEA 8 licenses in our company and we have a Grails project just waiting for this bug fix. :-(
Attached is a Groovy plugin version compatible with 8.1.3 which should fix this problem. Please check if it works.
Attachment(s):
Groovy.zip
Thank you so much, Peter. It worked well lin 8.1.3.