倭マン's BLOG

くだらない日々の日記書いてます。 たまにプログラミング関連の記事書いてます。 書いてます。

commons-logging 1.1 の依存性

m2 プロジェクトで commons-logging を使う」のところで取り上げた commons-logging 1.1

log4j を強制的にダウンロードするのはまだ分からなくもないけど*1、logkit や avalon-framework、果てには servlet-api まで強制的にダウンロードするのはおかしいなぁ・・・とずっと疑問に思っていた。 どれも数十 KB だからかなぁ?と思いつつも、commons-logging 1.0.x 系では上記のライブラリは optional 扱いになっているのに。

で、最近 commons-logging 1.1.1 の Release Notes にその原因が書いてあるのを発見!! (JCL = Apache Commons Logging)

As JCL didn't provide a Maven2 pom.xml file, one was helpfully created by people
not involved with the commons-logging project and published to the standard maven
repositories. Unfortunately this pom declared normal dependencies on all the logging
libraries that are supported by the core JCL distribution, meaning they all get pulled
into a project that declares a dependency on JCL1.1. This release now provides an
"official" pom.xml which declares these dependencies as optional so they aren't
automatically included in projects that depend on JCL 1.1.1.

要は「optional」で宣言し忘れただけかよ!! commons-logging 1.1.1 では「optional」で宣言するそうだけど、まだ Maven2リポジトリには配備されていない模様。 java.util.logging に乗り換えようか・・・

*1:commons-logging は log4j からログ出力のためのインターフェースを抽出したようなものなので。