views:

2109

answers:

1

I am looking for a tool which would create ejb-jar.xml configuration file from annotated EJB3 classes. Something like XDoclet, but for annotations, not tags in comments.

A: 

I don't know if such a tool exists, but Java does come with a nice set of tools to build your own programs to process annotated classes. The Annotation Processing Tool (APT) makes it easy to process annotations. I suspect that you use some small subset of the EJB3 annotations, so you don't need to support the entire spec. You could probably even write a quick processor to discover all of the annotations that you use and report on them, so that you had a clean list of which annotations you needed to handle.

Ant also as an apt task, which can make the process easier to run.

If you do end up taking this on, even if your implementation isn't complete (i.e. it doesn't cover every possible EJB3 annotation/option) it could be worth posting the code somewhere like Google Code so that others can benefit, and possibly extend the tool to support more extensive options.

Adam Batkin