First of all, let me congratulate you for creating an excellent scripting for eclipse. I love groovy and your plugin rocks! I was thinking of coming up with something similar to that and I find yours. Hats off!! once again.
I was playing with your plugin and there were some issues I faced. I am elucidating them below,
*) Static imports dont work. They throw up compilation issues.
*) I want to access some classes in a jar file. How do I do that ? I tried adding the jar to
the PATH variable it did not work. How can I solve this situation ?
First off thanks for giving groovy monkey a look. Ok I want you to check a couple of things.
Things to check:
1. Make sure the you don't have the plugin Eclipse Monkey installed. This is probably not your problem, but it bears mentioning.
2. I am not sure static imports are supported. Check your version of the org.codehaus.groovy plugin and see it matches the version of Groovy that supports that feature.
3. This one is easy. Groovy Monkey has an 'Include' metadata keyword. From there you can add class folders or jars. The only limitation is that the jar file must be in the workspace. You can include it in a project in your workspace or externally link it in. From the groovy monkey editor, just right click and select the 'Include' option and it should work. Btw, I have unit tests to back this one up.
I'm having issues using external classes even though I used the Include: directive to include the build dir or the jar from a workspace project. It's like the Include directive is broken.
I finally copied the code I needed inside my gm script and got it working this way. But I shouldn't really.
I'm on eclipse 3.6.2 on linux 64bit.
Groovy Monkey 0.6.1
Groovy-Eclipse Feature 2.1.2.xx-20110307-1500-e36
which includes org.codehouse.groovy 1.6.7 and 1.7.8
Maybe some incompatibility with latest groovy or groovy-eclipse plugin?
Here's how to reproduce my case where Include does not work.
1. Import the JSAP project in the workspace.
2. Add the following script:
* Menu: UseJSAP
* Script-Path: /GroovyMonkeyScripts/monkey/UseJSAP.gm
* Kudos: fmjrey
* License: EPL 1.0
* Include: /JSAP/build
3. run the script and obserbve failure:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
UseJSAP.groovy: 9: unable to resolve class com.martiansoftware.jsap.stringparsers.ColorStringParser
@ line 9, column 1.
at java.security.AccessController.doPrivileged(Native Method)
I solved my problem.
First, the JSAP project was located outside my workspace. I knew that for "Include:" to work the target should be in a project from the workspace, but I didn't know I had to take this literally: it should be under the workspace directory on the file system, not elsewhere.
To remove this limitation I looked up the code and managed to remove this limitation.
The change is limited to the function net.sf.groovyMonkey.lang.MonkeyScript.getIncludes(ScriptMetadata) which should have the following code:
final IFile ifile = getWorkspace().getRoot().getFile(new Path(include));
final URI uri = ifile.getRawLocationURI();
final File file = new File( uri );
final URL url = file.isDirectory() ? new URL( addSlash( uri.toString() ) ): uri.toURL();
includes.add( url );
Because I've made other changes to this project I've shared my clone on github:
It contains the aforementioned change in its own topic branch.
See related patch tracker item:
Thanks for the heads up, I am sorry I did not reply sooner. I will look at your patch and see about including it in a new release.
I have also been wanting better integration with the Eclipse JDT to allow you to just specify an eclipse java project in your workspace as a dependency and then automatically slurp in all its dependencies through its classpath configuration.
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.