2

Hi all I was wondering how do we set Eclipse to run a script on the Java source files for the project before compiling it into bytecode?

If anyone was wondering why I would like to do it, I was looking for a permanent solution to this problem, but of course more things could be accomplished with the functionality to run scripts before compilation.

Community
  • 1
  • 1
Pacerier
  • 86,231
  • 106
  • 366
  • 634

3 Answers3

4

In Eclipse you can define custom builders for your files. For this open the project properties and go to the "builders" page. Here you can add an arbitrary program that is launched every time a file in your workspace changes. You have many possibilities to customize the build progress. Move your newly created builder on top of the builders list to have it executed before the Java builder.

You can also define a custom ant task.

Boris
  • 7,054
  • 1
  • 15
  • 13
2

My suggestion is use ant to iterate over your set of files, calling exec to run your script. This question is similar to what you want to do.

Community
  • 1
  • 1
Andrew Fielden
  • 3,751
  • 3
  • 31
  • 47
-1

You can use Apache Ant for building you program. Then run a script with Ant before starting to compile the sources.

Jan Henke
  • 875
  • 1
  • 15
  • 28