Pregunta

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?

¿Fue útil?

Solución

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top