Revision 1 as of 2010-09-23 02:19:26

Clear message
Locked History Actions

ivy/NoPom

pom.xmlが無視される

Ivyでは多くの場合、依存をmaven2リポジトリ上から取得してくるが、そのpom.xmlはIvyの形式(ivy.xml)に自動変換されてivyキャッシュに格納される。例えば、プロジェクト中でguice-2.0への依存を宣言すると、ivyはmaven2リポジトリからそれを取得し、以「${user.home}/.ivy2/cache/com.google.inject/guice」に以下を作成する。

  • ivy-2.0.xml.original ... オリジナルのguiceのpom.xmlファイル
  • ivy-2.0.xml ... 上をivy.xmlに自動変換したもの。
  • jars ... guice-2.0のjarファイルを格納するフォルダ
  • ivydata-2.0.properties ... 今のところ用途不明

ivy-2.0.xmlは以下のようになる。

<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven">
        <info organisation="com.google.inject"
                module="guice"
                revision="2.0"
                status="release"
                publication="20090801212549"
        >
                <description homepage="" />
                <m:dependency.management__com.google.inject__guice__version>2.0</m:dependency.management__com.google.inject__guice__version>
                <m:dependency.management__aopalliance__aopalliance__version>1.0</m:dependency.management__aopalliance__aopalliance__version>
        </info>
        <configurations>
                <conf name="default" visibility="public" description="runtime dependencies and master artifact can be used with this conf" extends="runtime,master"/>
                <conf name="master" visibility="public" description="contains only the artifact published by this module itself, with no transitive dependencies"/>
                <conf name="compile" visibility="public" description="this is the default scope, used if none is specified. Compile dependencies are available in all classpaths."/>
                <conf name="provided" visibility="public" description="this is much like compile, but indicates you expect the JDK or a container to provide it. It is only available on the compilation classpath, and is not transitive."/>
                <conf name="runtime" visibility="public" description="this scope indicates that the dependency is not required for compilation, but is for execution. It is in the runtime and test classpaths, but not the compile classpath." extends="compile"/>
                <conf name="test" visibility="private" description="this scope indicates that the dependency is not required for normal use of the application, and is only available for the test compilation and execution phases." extends="runtime"/>
                <conf name="system" visibility="public" description="this scope is similar to provided except that you have to provide the JAR which contains it explicitly. The artifact is always available and is not looked up in a repository."/>
                <conf name="sources" visibility="public" description="this configuration contains the source artifact of this module, if any."/>
                <conf name="javadoc" visibility="public" description="this configuration contains the javadoc artifact of this module, if any."/>
                <conf name="optional" visibility="public" description="contains all optional dependencies"/>
        </configurations>
        <publications>
                <artifact name="guice" type="jar" ext="jar" conf="master"/>
        </publications>
        <dependencies>
                <dependency org="aopalliance" name="aopalliance" rev="1.0" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
                <override org="com.google.inject" module="guice" matcher="exact" rev="2.0"/>
                <override org="aopalliance" module="aopalliance" matcher="exact" rev="1.0"/>
        </dependencies>
</ivy-module>

このように、dependencies部分に正しくaopallianceへの依存が記述されている。 が、どのようなタイミングがわからないが、これがうまくいっていない場合がある。例えば以下のようになる。

<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0">
        <info organisation="xxxx"
                module="xxxx"
                revision="0.1.3"
                status="release"
                publication="20100922230141"
                default="true"
        />
        <configurations>
                <conf name="default" visibility="public"/>
        </configurations>
        <publications>
                <artifact name="xxxx" type="jar" ext="jar" conf="default"/>
        </publications>
</ivy-module>

上のモジュールの元のpom.xmlには依存が記述されているのだが、ivy.xmlへの変換では抜け落ちてしまっている。

このような場合は一度該当部分(あるいは全部)のivyキャッシュを削除し、再度取得する。

※これでもうまくいかない場合がある、原因究明中。