Can't run groovy script in Groovy Grails Tool Suite - eclipse

I installed Groovy Grails Tool Suite Version: 3.5.0.RELEASE on a Windows system.
I have created a new 'Groovy' project using the eclipse Groovy project wizard. My project contains one script called 'HelloGroovy.groovy'. When I right click on my script, and choose 'Run As', I do not see any option to run my script except for 'Run Configurations'. I want to see a groovy script option instead. Is there something I need to do to set up my ide further?

I believe your problem is that you have a space in the path to your workspace. I just tried recreating your situation and when there is no space, it works. When there is a space (e.g. C:\Documents and Settings\Foo\Bar\workspace) the menu option doesn't show. I raised https://jira.codehaus.org/browse/GRECLIPSE-1737 to cover fixing it.

Related

Find the command and options used by NetBeans IDE

I am using a the NetBeans 7.x IDE. I have a Netbeans Application module. I use the Build and the Run buttons from the IDE. The module runs just fine when I press Run Project or F6 button. I like to run
this from the command line. Since everything was build automatically for
me I have no idea where things are or how to run it. There are several jar files in the project/build/public-package-jars. Is there a way to see what command and options the Run Project is using ?
Go to the root of the application (or wherever there is a build.xml file) on the command line and run ant -p. That will list all of the available options for building and running the application.

Access eclipse variables outside eclipse

I am working on an ant scrip that can be located in one place, but can be targeted to run on each project. I am able to do this in eclipse using the ${project_loc} variable in eclipse. I was also able to get this variable to work in ant, by setting it as a variable to through the eclipse preferences. This works fine, but it only works in eclipse. Is there any way that I could get the path to a specific project through a script so that I could run my ant script outside of eclipse?
Any help is appreciated.
Thanks
http://ant.apache.org/faq.html#passing-cli-args
ant -Dname=value

Unable to run a Subclipsed Groovy script in Eclipse

After installing the Groovy plug-in in Eclipse, clicking Run brought up a list: Groovy Console - Groovy Script - Java Application. I'd select Groovy Script and it would take off.
Now, after checking out a colleague's Groovy project with Subclipse, opening a script in it, clicking Run brings up "The selection cannot be launched, and there are no recent launches".
Selecting Run As... shows '(none applicable)'. So I select Run Configurations... and click Groovy Script, but the Run button stays dimmed. Eclipse evidently needs more info, but what?
I suspect your colleague didn't check in the .project file. It contains the "nature" that defines the project as being a Groovy project. I don't know for certain but it is not uncommon for eclipse actions to be predicated on the presence of an appropriate nature.
I would also check the .classpath is present and valid as it should contain the Groovy libraries required to compile and run your script.
Assuming they are missing, get your colleague to add them, and after syncing you should be good to go.

Eclipse "Waiting for virtual machine to exit"

I'm working on a blackberry project using eclipse and bb-ant tools. I've created a build.xml file to perform the build. Everytime I try to run an Ant build, eclipse pops up the progress dialog and it hangs stating "Waiting for virtual machine to exit."
I downloaded an open source Blackberry project that has an ant build and it is showing the same behavior.
Does anyone have any suggestions?
Edit:
I used the command line to build my xml file and it built fine. However, when I tried from Eclipse it still hangs.
I've tried both the standard eclipse plugin directory and the path I downloaded ant to.
You could check if your ANT_HOME settings are correct (see also this blog post).
"Window > Preference > Ant > Runtime": "Ant Home Entries".
if the jars files are from a plugin directory (beside the default 'org.apache.ant_1.7.1.v20090120-1145' one) and not an independent ant installation, that might explain the problem.
Try clicking the "Ant Home" button on the right side and setting up ant home such as "C:\path\to\apache-ant-1.7.0"
There are similar bugs to this kind of situation (bug 173419, ticket 91).
It is worth checking the JVM used for the project.
It can also occurs when a ant task is poorly implemented.
You had the problem because the java version ant tries to run with is incorrect.
By default, eclipse will try to run the ant build with the java version it uses to compile the java files (Blackberry JRE), which won't work! You need to change the jre version by choosing "Run As... > Ant build". Before clicking run, go to the JRE tab, choose "Separate JRE:" and change "Blackberry JRE " to a standard java JRE. Press the run button and everything should work correctly.
I hit this problem also. Although I never used the same solution, you pointed me in the same direction.
I was using a ant file as a builder in my project, and I disabled the Allocate Console build option. This is when I hit the 'Waiting for virtual machine to exit'.
So I simply enabled the Launch in background option and it worked.

Ant build won't run in Eclipse

I have an Ant build.xml which no longer runs when launched in Eclipse.
I click on the External Tools Configuration, select the Ant Build I've been running, and click Run.
Nothing happens -- no console window and the build doesn't appear to launch (the classes are not compile nor is the WAR file created).
I recently added a plugin (Spring IDE), this is the only thing I can think of that has changed recently as far as my Eclipse configuration.
I can run the Ant build fine from the command line.
Can anyone suggest where I might look to track down my error?
I'm using the Eclipse Helios release, Build id: 20100617-1415 on Windows XP.
As per pstanton's comment this symptom will occur if your ANT_HOME folder is not correctly defined in Eclipse. Eclipse seems to ignore the ANT_HOME system property.
window->preferences->ant->runtime->Classpath Tab
I faced same problem today , reason behind this was ANT_HOME path variable explained in other answers also.
Initially I added ANT_HOME at 2 places given below and it was not working.
window->preferences->ant->runtime->properties Tab
window->preferences->ant->runtime->Classpath Tab
But when I remove Classpath tab ant home entry ( by setting it to default using Restore default option on right bottom of preferences window ) it worked :). So far it is just a surprise for me because I added same ant home path at both the places.
You can check out the example in this Apache Ant tutorial.
But you can also try to run your same build.xml ant files through a Java Launcher, with org.apache.tools.ant.Main as the Main class.
That would at least prove your scripts are working in an Eclipse environment.
When you look at the Ant FAQ, you also see:
I installed Ant 1.6.x and now get java.lang.InstantiationException: org.apache.tools.ant.Main
The cause of this is that there is an old version of ant somewhere in the class path or configuration.
Maybe your error message is somehow hidden, but it can be worth checking your classpath and see if no other ant library is there.