简体   繁体   English

常春藤未能解决依赖:要检查什么,该怎么办?

[英]Ivy failed to resolve dependency : What to check, what to do?

I'm using Ivy to resolve dependency in my very small project. 我正在使用Ivy来解决我的小项目中的依赖。 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. 我在5分钟前尝试下载log4j时出现问题。

My configuration is very basic, I have an ant task : 我的配置非常基础,我有一个ant任务:

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

and my Ivy.xml file is like this : 我的Ivy.xml文件是这样的:

    <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 : 问题似乎发生在常春藤试图下载jms 1.1(我想它需要log4j),正如我在控制台中看到的那样:

:

:::::::::::::::::::::::::::::::::::::::::::::
[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 F

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. Ivy尝试下载它们的唯一原因是因为它们是在ibiblio的pom.xml中声明的。 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. 如果您尝试1.2.14版本,您将看到这些传递依赖项不在1.2.14 pom中,因此Ivy不会下载它们。

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: 或者,如果您希望坚持使用1.2.15,可以在您的ivy.xml文件中添加一个exclude元素 ,告诉Ivy忽略这些库:

<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 :) 希望有帮助:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM