I've read discussions that suggest that future J2EE versions will
be more driven by JSR 175 metadata than deployment descriptors. This
is a nice thought, but I don't think it will work out. Definitely SOME
information that is provided in deployment descriptors could move into
JSR 175 metadata, but I believe that external metadata can't be
entirely replaced by internal metadata. There are a couple of reasons
why internal metadata can't capture deployment data well.
Internal metadata is set in stone during development. There's
no technical reason why deployment tools can't rewrite the metadata
for deployment time configuration, but what happens when the code
needs to be updated? You would have to merge the code portions of
each new class with the data portions of the old classes. With
external metadata you physically separate the code and the metadata
and simple code updates are, well, simple.
Internal metadata is singular, but deployment data isn't.
If you have multiple customers for your application, this is obvious.
But even in-house and one customer product are deployed multiples times.
In addition to the production deployment, you probably have individual
developer deployments and QA deployments. Each of these environments
has it's own peculiar deployment details. Internal metadata can't
capture this type of information.
So, the summary is that deployment information doesn't belong in
source files. That may sound odd coming from an XDoclet fanatic.
But remember that XDoclet simply seeds the external metadata. That
metadata can still be easily customized at deployment. Beyond that,
XDoclet metadata can come from build time properties, which allows
your source code to reference the raw deployment data rather than be
the source of it if that works best for a project. The XDoclet tags
provide structure and linkage for the raw data. This simply isn't
possible with internal metadata.
JSR 175 is the most exciting of the upcoming Java language
features. I think it will have a huge impact on the way we write Java
code. But don't expect JSR 175 internal metadata to liberate you from
deployment descriptors.