tags:

views:

62

answers:

3

Hi,

I have an ant script that creates runnable jar and I want it to run each time I make changes in my code and save them. I guess I need some "auto build after save" option in eclipse. Is there such a thing?

Thanks, Dave

+1  A: 

You could declare your script as a builder, and make it run "during auto build".

alt text

See the properties of your project: you can add an external program (above) or an an script (below).

alt text

If you can export your script as an ant script, like the OP did in his answer, it becomes quite easy:

  1. Export as an ant script: right-click the project -> export -> runaable jar file, tick "save as ANT script" and finish.
  2. Add the ant script as a builder: right-click the project -> properties -> Builders -> new (Ant).
    Paste the path for the ant file, go to "targets" tab and click the "set targets" button next to "auto build".
    Finally, click OK, OK, OK.
VonC
I like the screenshots, which app did you use?
zengr
@zengr: [FastStone Capture](http://www.faststone.org/FSCaptureDetail.htm), see comments of http://meta.stackoverflow.com/questions/19478/the-many-memes-of-meta/19775#19775
VonC
A: 

Use an ANT file which will be triggered everytime you save a file: Using Ant to Auto-Build in Eclipse

zengr
A: 

Actually, the best solution I found was: right-click the project -> export -> runaable jar file, tick "save as ANT script" and finish. Now right-click the project -> properties -> Builders -> new -> paste the path for the ANT file, go to "targets" tab and click the "set targets" button next to "auto build", OK, OK, OK.

David B
Good point. I have included your process next to the screenshot of the ant builder in my answer.
VonC