1

Eclipse can compile java source code to byte code automatically. I write some enhancers with javassist, which can modify the existing byte code and add some new fields and methods to them.

How to configure eclipse that when it compiles, it will automatically invoke my enhancers to modify the byte code and save them to .class files as normal? That my other java code can find and invoke these new fields and methods.

Is it a complicated work that may be I need to write a custom eclipse plugin?

4

1 回答 1

1

You don't need to write a plugin, you only need to add a builder to each Java project where you want to invoke your tool. Use project properties -> Builders -> New to either add a small Ant script or an external program. That builder is then invoked each time the eclipse build process runs.

There is a small tutorial in the eclipse help to demonstrate this.

于 2013-03-31T07:56:55.277 回答