[英]Ivy can not resolve the scope of a dependency which is a dependency of a transitive dependency
I add a dependency(let's name it as A) to ivy.xml which has a pom file in maven central. 我向ivy.xml中添加了一个依赖项(让我们将其命名为A),它在maven Central中具有pom文件。 Ivy uses ibiblio for resolving the maven dependencies.
Ivy使用ibiblio解决了Maven依赖关系。 The dependency(A) which is added to ivy.xml has a transitive dependency(B).
添加到ivy.xml的依赖项(A)具有传递的依赖项(B)。 So far so good till here.
到目前为止,到目前为止很好。 The dependency(C) of transitive dependency(B) can not be resolved by ivy.
常春藤无法解决传递性依赖项(B)的依赖项(C)。
I defined A in ivy.xml like this: 我在ivy.xml中定义了A,如下所示:
<dependency org="Z" name="A" rev="0.6-SNAPSHOT" conf="*->default"/>
In pom file of B, C is defined both in compile and test scopes like below: 在B的pom文件中,在编译和测试范围中都定义了C,如下所示:
<dependency>
<groupId>X</groupId>
<artifactId>C</artifactId>
</dependency>
<dependency>
<groupId>X</groupId>
<artifactId>C</artifactId>
<type>test-jar</type>
<scope>test</scope>
</dependency>
When I look the xml file of B which is resolved by ivy in ivy's cache file(~/.ivy2/cache/X/C/ivy-0.98.8-hadoop2.xml), it looks like this: 当我在常春藤的缓存文件(〜/ .ivy2 / cache / X / C / ivy-0.98.8-hadoop2.xml)中查看由常春藤解析的B的xml文件时,它看起来像这样:
<dependency org="X" name="C" rev="0.98.8-hadoop2" force="true" conf="test->runtime(*),master(*)"/>
<dependency org="X" name="C" rev="0.98.8-hadoop2" force="true" conf="test->runtime(*),master(*)">
<artifact name="C" type="test-jar" ext="jar" conf="" m:classifier="tests"/>
</dependency>
For this reason, ivy can not define C scopes correctly. 因此,ivy无法正确定义C范围。 For the record, I don't have permissions to modify the pom files as they are third party projects.
作为记录,我没有权限修改pom文件,因为它们是第三方项目。 How can I fix it ?
我该如何解决?
I reviewed the ivy usage of the nutch project and apologies but my conclusion is that it's overly complex for the following reasons: 我回顾了常春藤项目和道歉的用法,但我的结论是它过于复杂,原因如下:
I started to refactor the build, but had to stop when I realised that I didn't understand the relationship between the main nutch artifact and the plugins... (I discovered NUTCH-1515 the hard way... big time-waster The feed plugin has missing dependencies). 我开始重构构建,但是当我意识到我不了解主要的坚果工件和插件之间的关系时不得不停下来……(我发现NUTCH-1515的方法很艰辛……浪费大量时间。 feed插件缺少相关性)。
I also noticed issue NUTCH-1371 calling for the removal of ivy. 我还注意到问题NUTCH-1371要求移除常春藤。 This would be a tricky refactoring without significant change to the current codebase.
如果不对当前代码库进行重大更改,这将是一个棘手的重构。 I suspect it would have to be a multi-module build with each plugin listing its own dependencies.
我怀疑这将是一个多模块构建,每个插件都列出了自己的依赖关系。
In conclusion, this work does not answer your question, but thought I needed to at least document the result of a few hours analysis :-) In light of NUTCH-1371 I don't know if your project will tolerant major ivy refactoring? 总之,这项工作不能回答您的问题,但是我认为我至少需要记录几个小时的分析结果:-)鉴于NUTCH-1371,我不知道您的项目是否可以承受主要的常春藤重构?
Here follows what I achieved so far: 这是我到目前为止所取得的成就:
Benefits: 优点:
Impacts the following Nutch issues 影响以下Nutch问题
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.