May 27, 2006

[Maven] pom.xml で entity reference が使えない理由

pom.xml では entity reference が使用できない。 使えないのは実際に試した結果から知っていたが、理由が分からなかった。 ようやく使えない理由が書かれたドキュメントを見つけたのでメモ。 Maven 1.x の FAQ なのだけれど、Maven 2.x でも同様の理由で使えなくなっているのだろう。 使えると非常に便利なのだけれど、機構的に仕方がないといったところか。

Apache Maven 1.x Frequently Asked Questions
http://maven.apache.org/maven-1.x/faq.html#using-entities
Q. What's the problem with entities in project.xml?

A. As of Maven 1.1, external entities will not be enabled by default in project.xml, and their use is discouraged in Maven 1.0.x as well. There will still be the ability to use them, but it will have to be enabled.

There are several reasons for this, but the main reason is that the content of project.xml needs to be completely self-contained and and able to be reproduced from a history at any point in time.

For this reason, using Jelly expressions other than ${pom.*} references is also not recommended and likely to be unsupported in future.

The most common use of this technique is to manage dependencies across multiple projects. You should strongly consider using inheritence for this purpose.

Note: special character entities will always be supported and should not have any current issues.

Posted in Maven | このエントリーをはてなブックマークに追加 | この記事をクリップ! livedoor クリップ |