Access eclipse variables outside eclipse - 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

Related

Can't run groovy script in Groovy Grails Tool Suite

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.

Can I use Windows Environment Variables into Eclipse Workspace path?

When you start Eclipse for the first time, it asks you the path for the workspace. Now, normal path should be C:\Users\USERNAME\Workspace but, if I try to set %USERPROFILE%\Workspace it doesn't work, it creates a folder called %USERPROFILE%\Workspace under the Eclipse folder.
So the question is: how to use windows environment variables to specify workspace path? Thank you.
P.S: I know that Eclipse has got customizable environment variables but I didn't try them and I want to use them neither.
You can run eclipse.exe -data %USERPROFILES%\myCustomWorkspaceDir to have the workspace in your wanted sub directory. In this case, you will not even get the dialog asking for the workspace.
There are still more runtime options for Eclipse.

update eclipse workspace with ant-errors

I have LaTeX project that is hosted in the eclipse environment. To compile the LaTeX code I'm using an ant script that calls pdflatex.exe from a local MiKTeX installation. This works fine for me so far.
Now the question: In case the compilation with pdflatex.exe detects some errors in the .tex files. Is there any way to tell eclipse from the ant script, what files have errors and to mark those files in the project explorer with a red mark or something so that they are easily to identify?
The marks are called label decorations. How do I set them via an ant script? Is there some file-property that could be set eventually?
You can't add error markers on project resources from an Ant script, but you could try TeXlipse plugin that may do the work for you.

GWT_HOME variable setup problems

i installed GWT using Eclipse wizard to be more precise, i followed this tutorial: https://developers.google.com/web-toolkit/usingeclipse?hl=pt-PT
I now have GWT working in my eclipse indigo release. But now i need to define the GWT_HOME variable (ambient variable) so i can run a project using a build file.
Because i installed the gwt plugin with the eclipse wizard, i don't know how to setup the ambient variable, because i can't seem to find the folder where gwt got installed.
I'm using eclipse indigo on windows 7.
Can anybody help me?
Maybe you used the update site for Eclipse 3.6 instead of 3.7
This one should be the correct one for Indigo: http://dl.google.com/eclipse/plugin/3.7
When you have installed GWT like described here you just go into:
Eclipse > Preferences > Window Builder GWT and in GWT_HOME variable you click Browse and select the gwt folder inside your Eclipse plugin directory.
(For example:
.../eclipse-modeling-indigo-sr2-64/plugins/com.google.gwt.eclipse.sdkbundle_2.4.0.v201205091048-rel-r37/gwt-2.4.0/
)
You can also check the correct path under:
Eclipse > Preferences > Google > Web Toolkit
Regards,
Fachexot
I ran into the same problem on Linux running ant from the command line.
I got around the problem by running ant as:
ant -Dgwt.sdk=$GWT_HOME war
FYI the line:
is in build.xml.
I believe name property is not the way to set gwt.sdk variable. I.e., the problem is with:
Behdad
I am using Indigo 3.7, I could not find Eclipse > Preferences > Window Builder GWT (as suggested by fachexot), but I found that if I set the environment variable GWT_HOME in Windows 7 my ant would be able to use the value.
To set the environment variable, in Windows 7, type "environment" in the search box of "Start" and then click "Edit environment variables for your account", and then "New" a "User variable" called "GWT_HOME" (you have first look up the exact path to GWT folder inside your Eclipse plugin directory).
After that, remember to restart eclipse so that the new environment can be picked up by the program.
On Mac OSX, if you want to access the variable from an ANT build as ${env.GWT_HOME} run from within Eclipse or some other IDE then you need to use launchctl as envoronment variables set per normal in NIX envoronments is not passed to OSX windows apps.
The simplest way to do this is add the following 2 lines to your .bashrc (replacing the path shown with the correct one for your install):
export GWT_HOME=${HOME}/.p2/pool/plugins/com.google.gwt.eclipse.sdkbundle_2.7.0/gwt-2.7.0
launchctl setenv GWT_HOME $GWT_HOME

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.