在做JavaEE开发时,会涉及到使用各种中间件,有许多中间会使用XML进行配置,典型的如hibernate的实体映射文件,spring的bean的配置文件等等,当然这些配置目前些框架也支持Annotation方式的配置。今天这里一个XDoclet框架,也可以做类似的事,并且是一个通用的代码引擎生成工具。以下介绍来译自其官方的一分钟介绍文档(原文http://xdoclet.codehaus.org/One+Minute+Introduction)
XDoclet will parse your source files and generate many artifacts such as XML descriptors and/or source code from it. These files are generated from templates that use the information provided in the source code and its JavaDoc tags.
XDoclet将解析你的代码源文件并且生成相应的一些文件。这些文件是根据源代码中的一些JavaDoc标记通过模板生成的。
XDoclet lets you apply Continuous Integration in component-oriented development. Developers should concentrate their editing work on only one Java source file per component.
XDoclet可以让你在进行基于中间件的开发过程中执行持续集成。这样,开发人员将使他们的精力只放在相关组件的代码编写上。
This approach has several benefits:
使用XDoclet会有以下几点好处:
Java Open Source Programming(Java 开源编程)
Currently XDoclet can only be used as part of the build process utilizing Jakarta Maven or Ant.
当前XDoclet只能利用Maven或Ant来做部分的构建过程。
Although XDoclet originated as a tool for creating EJBs, it has evolved into a generalpurpose code generation engine. XDoclet consists of a core and a constantly growing number of modules. It is fairly straightforward to write new modules if there is a need for a new kind of component.
尽管XDoclet起初只是作为一个辅助EJB开发的工具,但是它现在已经发展成一个通用代码生成引擎。XDoclet由一个内核和一些插件组成。如时你想为一个Java EE的组件写一个新的插件是非常容易的。
XDoclet comes with a set of modules for generation of different kinds of files. Users and contributors can write their own modules (or modify existing ones) if they wish to extend the functionality of XDoclet.
XDoclet在运行时,会通过一系列的插件来生成各类不同的文件。用户可以发布他们自己写的插件或者编辑已存在的插件来进行功能的扩展。