문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top