Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Ant integration in Eclipse

 
Anders Olsen
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As I wrote in another topic, I'm trying to get Eclipse to work on an existing development project.
In this project, we have an Ant build.xml script, that I would like to use in Eclipse. In our project, we have some scripts that sets up the CLASSPATH environment, and we use this in the build.xml by setting the attribute classpath="${env.CLASSPATH}" in e.g. the rmic target.
Is it possible to set this environment variable from Eclipse when running the Ant script? I have tried adding jars and folders in Windows->Preferences->Ant->Runtime, but if I add an echo target to my build.xml script, it doesn't seem to work. Example: I have added the following line to one of my targets:
<echo message="${env.CLASSPATH}" />
When I run the target from Eclipse, it prints out:
[echo] ${env.CLASSPATH}
If I run it from a command prompt with CLASSPATH setup, it echos the classpath as I would expect.
I'm running Eclipse on Windows 2000 if that makes a difference.
I hope that some of you can help me. I would really love to use Eclipse with out project, but so far, I have run into a lot of troubles adapting it to our project.
Regards
Anders
 
Charles Hasegawa
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you add

to your ANT script (we just add this at the top)? I believe you need to do this to include system environmental values. If you do this and still get the same [echo] value, then "CLASSPATH" isn't recognized as an environmental variable on your system.
[ July 08, 2003: Message edited by: Charles Hasegawa ]
[ July 08, 2003: Message edited by: Charles Hasegawa ]
 
Anders Olsen
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you, that worked.
I also had to set the CLASSPATH environment before starting Eclipse. I tried to use the properties that I could set through Eclipse, but that didn't seem to work.
Regards
Anders
 
David Hibbs
Ranch Hand
Posts: 374
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's another handy trick I've picked up... you can check if the script is being run from inside Eclipse/WSAD and do things like match the compiler...

If you need to adjust your classpath when running in eclipse vs. running from the command line, you can do so!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic