Custom build rules for Eclipse

I have a Java project that uses some autogenerated source code. This source code is generated using the command line tool --- Bison, in fact --- from a special source file.

I would like the Java source to recover automatically when needed, when I click the "build" button in Eclipse. Is this possible, and if so, how?

Normally I would integrate this into the project’s makefile, but of course it’s Java and it doesn’t use makefiles. I looked at ant, but ant seems pretty hostile to traditional command line tools. I know that this is possible with the built-in developer Eclipse, because the Android developer kit does this; so what is he doing

+2
source share
1 answer

Right-click the project, select Properties > Builders > New ... > Program .

Here you can select a command line tool that will be launched whenever a project is created.


For completeness: this solution is for Eclipse only. I would recommend that you use a build system instead of regular Eclipse. Both Maven and Ant combine perfectly with Eclipse (Maven via m2eclipse , Ant via the same Builder mechanism as above), possibly others as well.

With Maven you will use exec:exec ( usage ).

With Ant, you must use the <Exec> task.

+7
source

All Articles