Ivy failed to resolve dependency : What to check, what to do?
Asked Answered
B

1

5

I'm using Ivy to resolve dependency in my very small project. It's the first time I'm doing that and it's more to learn as my project is very small.

I had a problem 5 minutes ago, when trying to download log4j.

My configuration is very basic, I have an ant task :

<target name="resolve" description="--> retrieve dependencies with ivy">
        <ivy:retrieve/>
    </target>

and my Ivy.xml file is like this :

    <dependency org="javax.servlet" name="servlet-api" rev="2.5" />
    <dependency org="log4j" name="log4j" rev="1.2.15" />


</dependencies>

The problem is seems to happen when ivy tries to download jms 1.1 (I suppose it's needed for log4j) as I can see in the console :

:

:::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve]      ::              FAILED DOWNLOADS            ::
[ivy:retrieve]      :: ^ see resolution messages for details  ^ ::
[ivy:retrieve]      ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve]      :: javax.jms#jms;1.1!jms.jar
[ivy:retrieve]      :: com.sun.jdmk#jmxtools;1.2.1!jmxtools.jar
[ivy:retrieve]      :: com.sun.jmx#jmxri;1.2.1!jmxri.jar
[ivy:retrieve]      ::::::::::::::::::::::::::::::::::::::::::::::

Is there anything I can do ?

Thanks a lot guys.

F

Barabbas answered 15/10, 2009 at 19:30 Comment(0)
B
9

The problem is, as you have realised, that those jars are not in the remote repositories. But they might not really be required for your program. The only reason Ivy tries to download them is because they are declared in the pom.xml on ibiblio. If you try version 1.2.14 you will see that these transitive dependencies are not in the 1.2.14 pom, and so Ivy won't download them.

Alternatively, if you wish to stick with 1.2.15, you can add an exclude element to your ivy.xml file to tell Ivy to ignore those libraries:

<dependency org="log4j" name="log4j" rev="1.2.15">
  <exclude org="com.sun.jdmk"/>
  <exclude org="com.sun.jmx"/>
  <exclude org="javax.jms"/>
</dependency>

Hope that helps :)

Brendabrendan answered 20/10, 2009 at 18:50 Comment(1)
In case somebody using sbt ends up here, the following syntax can be used (taken from sbt manual): libraryDependencies += "log4j" % "log4j" % "1.2.15" excludeAll( ExclusionRule(organization = "com.sun.jdmk"), ExclusionRule(organization = "com.sun.jmx"), ExclusionRule(organization = "javax.jms") )Brogan

© 2022 - 2024 — McMap. All rights reserved.