Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

eclipse: auto build after save

Tags:

eclipse

build

ant

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?

like image 746
David B Avatar asked Jul 29 '10 08:07

David B


People also ask

Does Eclipse compile automatically?

By default, you are in auto-build mode and Eclipse takes care of compiling source files automatically. Builds occur automatically in the background every time you change files in the workspace (for example saving an editor). Auto-build is convenient because it means problems view, binaries, etc.

How do I turn off auto compile in Eclipse?

1 Answer. Show activity on this post. If you want to turn off auto Building your project, click the Project menu and uncheck the Build automatically menu. Also available in the Workspace settings: Windows –> Preferences –> General –> workspace --> uncheck "Build Automatically" box.

How do I stop building workspace in STS?

4 Answers. Show activity on this post. Building workspace is about incremental build of any evolution detected in one of the opened projects in the currently used workspace. You can also disable it through the menu " Project / Build automatically ".

What does build in Eclipse do?

Eclipse source builds provide developers with an automated method for checking out source code and other required resources, compiling the Java code, generating javadoc, and finally, copying launcher files to the right location to launch Eclipse. The end result of a source build is a runnable Eclipse.


2 Answers

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

Launch configuration properties

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

Target

If you can export your script as an ant script, like the OP David B 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.
like image 107
VonC Avatar answered Oct 03 '22 09:10

VonC


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.

like image 27
David B Avatar answered Oct 03 '22 10:10

David B