You are not allowed to edit this page.

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への依存が記述されている。 これがうまくいかない場合がある。アーティファクトのjarは取得できるものの、pom.xmlが取得できないため、ivyはこのアーティファクトについては勝手にデフォルトのivy.xmlを作成してしまい、そのアーティファクトの依存(現在のプロジェクトから見ると推移的依存)が抜け落ちてしまうことがある。

<?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>

このケースはivysettings.xmlのリゾルバ指定の問題と思われる。このときの、ivyの出力を観察してみると ivy/IvyDE/consoleの訳注のやり方でチェック)、以下のような出力が見られる。

[ivy:resolve] loadData of clog#clog;0.1.3 of rootConf=compile
[ivy:resolve]   using chainedResolvers to resolve clog#clog;0.1.3
[ivy:resolve] chainedResolvers: Checking cache for: dependency: clog#clog;0.1.3 {compile=[compile(*), master(*)], runtime=[runtime(*)]}
[ivy:resolve]   no ivy file in cache for clog#clog;0.1.3: tried C:\Users\admin\.ivy2\cache\clog\clog\ivy-0.1.3.xml
[ivy:resolve]   no ivy file in cache for clog#clog;0.1.3: tried C:\Users\admin\.ivy2\cache\clog\clog\ivy-0.1.3.xml
[ivy:resolve]    trying file:C:\Users\admin/.m2/repository/clog/clog/0.1.3/clog-0.1.3.pom
[ivy:resolve]           tried file:C:\Users\admin/.m2/repository/clog/clog/0.1.3/clog-0.1.3.pom
[ivy:resolve]   local: resource not reachable for clog#clog;0.1.3: res=file:C:/Users/admin/.m2/repository/clog/clog/0.1.3/clog-0.1.3.pom
[ivy:resolve]    trying file:C:\Users\admin/.m2/repository/clog/clog/0.1.3/clog-0.1.3.jar
[ivy:resolve]           tried file:C:\Users\admin/.m2/repository/clog/clog/0.1.3/clog-0.1.3.jar
[ivy:resolve]   local: resource not reachable for clog#clog;0.1.3: res=file:C:/Users/admin/.m2/repository/clog/clog/0.1.3/clog-0.1.3.jar
[ivy:resolve]   local: no ivy file nor artifact found for clog#clog;0.1.3
[ivy:resolve]   no ivy file in cache for clog#clog;0.1.3: tried C:\Users\admin\.ivy2\cache\clog\clog\ivy-0.1.3.xml
[ivy:resolve]    trying http://repo1.maven.org/maven2/clog/clog/0.1.3/clog-0.1.3.pom
[ivy:resolve]           tried http://repo1.maven.org/maven2/clog/clog/0.1.3/clog-0.1.3.pom
[ivy:resolve] HTTP response status: 404 url=http://repo1.maven.org/maven2/clog/clog/0.1.3/clog-0.1.3.pom
[ivy:resolve] CLIENT ERROR: Not Found url=http://repo1.maven.org/maven2/clog/clog/0.1.3/clog-0.1.3.pom
[ivy:resolve]   ibiblio: resource not reachable for clog#clog;0.1.3: res=http://repo1.maven.org/maven2/clog/clog/0.1.3/clog-0.1.3.pom
[ivy:resolve]    trying http://repo1.maven.org/maven2/clog/clog/0.1.3/clog-0.1.3.jar
[ivy:resolve]           tried http://repo1.maven.org/maven2/clog/clog/0.1.3/clog-0.1.3.jar
[ivy:resolve] HTTP response status: 404 url=http://repo1.maven.org/maven2/clog/clog/0.1.3/clog-0.1.3.jar
[ivy:resolve] CLIENT ERROR: Not Found url=http://repo1.maven.org/maven2/clog/clog/0.1.3/clog-0.1.3.jar
[ivy:resolve]   ibiblio: resource not reachable for clog#clog;0.1.3: res=http://repo1.maven.org/maven2/clog/clog/0.1.3/clog-0.1.3.jar
[ivy:resolve]   ibiblio: no ivy file nor artifact found for clog#clog;0.1.3
[ivy:resolve]   no ivy file in cache for clog#clog;0.1.3: tried C:\Users\admin\.ivy2\cache\clog\clog\ivy-0.1.3.xml
[ivy:resolve]    trying http://10.8.0.1:8001/maven2/clog/clog/0.1.3/clog-0.1.3.jar
[ivy:resolve]           tried http://10.8.0.1:8001/maven2/clog/clog/0.1.3/clog-0.1.3.jar
[ivy:resolve]   internal: no ivy file found for clog#clog;0.1.3: using default data

最後の「no ivy file found for clog#clog;0.1.3: using default data」がこの状態を示している。