How make Eclipse instrument classes at build time?
Sometimes I have to perform some custom bytecode transformation. I have used mainly asm and javaassit.
Inside eclipse usually I run my code with the -javaagent jvm parameter. Outside eclipse I use maven, ant, or the command prompt to invoke the weavers before running the application code.
But the point is that: I would like to perform instrumentation at build time inside eclipse.
- What is the best开发者_开发百科 way to do it?
- Is there an already made plugin that I can connect to by implementing some api?
- May I script this with eclipse monkey?
- May I use an ant builder and invoke my weaver with it?
- Should I look at the AspectJ plugin (must be huge) and try to figure out how to make my own plugin?
- Should I look at the some other plugin to get inspiration?
Thanks.
You can create an annotation processor. This way you will be able to use it with ant, maven and any IDE (not only Eclipse). Here is an example: http://java.dzone.com/news/using-java-6-processors
精彩评论