简体   繁体   English

使用常春藤指定传递依赖项

[英]Specify Transitive Dependencies with Ivy

Ok, so say I have a module that all of my projects build on, "Module_A", I then have "Module_B" which builds on A and finally I have my top level project which depends on B and so also needs the appropriate version of A. 好的,假设我有一个所有项目都基于“ Module_A”的模块,然后有一个基于A的“ Module_B”,最后我有了依赖于B的顶级项目,因此还需要适当的版本一种。

Both Module A and B are being published to Artifactory using Ivy from an ant script. 使用蚂蚁脚本中的Ivy将模块A和B都发布到Artifactory。 When I come to develop Module BI can use IvyDE to resolve my dependency on Module A. 当我开发模块BI时,可以使用IvyDE来解决我对模块A的依赖。

The problem I have is when I come to develop my top level project, I specify that I am dependent on Module B and I want Module A also to be pulled from Artifactory but this doesn't happen and I'm not sure what I need to do to make it happen. 我遇到的问题是,当我开始开发顶层项目时,我指定我依赖于模块B,并且我也希望从Artifactory中提取模块A,但这不会发生,并且我不确定我需要什么做到这一点。

So for clarity with the following ivy file I want both Module B and its dependency Module A to appear, as if by magic, on my class path. 因此,为了清楚起见,我希望下面的常春藤文件同时在我的类路径上同时显示模块B及其依赖模块A,就像魔术一样。

<dependencies>
   <dependency org="MY_ORG" name="NAME" rev="latest.integration">
      <artifact name="MODULE_B" type="jar" ext="jar" />
   </dependency>
</dependencies>

When I look at some of the jars I have resolved, say guava, this has its META-INF directory populated with a pom file. 当我看一些我已经解决的罐子时,比如说番石榴,它的META-INF目录中装有一个pom文件。 Is there an equivalent for Ivy that I need to create and bundle inside the jar? 我需要在罐子中创建并捆绑常春藤的等效物吗?

Thanks. 谢谢。

Edit 编辑

I believe some of the above is incorrect and IvyDE should just be using the ivy file hosted by artifactory to determine the transitive dependencies, not looking inside a jar - when I look at the file held by artifactory it does define the transitive dependencies that I want resolved. 我相信上面的某些内容是不正确的,并且IvyDE应该仅使用由人工制品托管的ivy文件来确定传递依赖关系,而不是在jar中查看-当我查看由人工制品保存的文件时,它确实定义了我想要的传递性依赖关系解决。 When I look at the IvyDE cache it contains a different ivy file with a default configuration that doesn't exist in artifactory and no dependencies! 当我查看IvyDE高速缓存时,它包含一个具有默认配置的其他ivy文件,该文件在工件中不存在且没有依赖项!

I'm getting towards the point of deciding that either Ivy, IvyDE and/or Artifactory are a waste of time... can someone please suggest what might be going wrong. 我要判断Ivy,IvyDE和/或Artifactory都是浪费时间……有人可以建议出什么问题了。

The problem, I believe I have resolved, by using URL resolvers rather than ibiblio. 我相信这个问题已经通过使用URL解析器而不是ibiblio解决了。 Despite using Ivy to publish to artifactory and using Ivy to resolve my dependencies I needed to use the URL resolver to allow me to specify the ivy pattern. 尽管使用Ivy发布到工件,并使用Ivy来解决我的依赖关系,但我仍需要使用URL解析器来指定ivy模式。 Once I had done this my transitive dependencies started to be resolved. 完成此操作后,我的可传递依赖关系就开始得到解决。

Just to note, I'm still using an ibiblio resolver for my external dependencies like junit. 请注意,我仍在使用ibiblio解析器来处理诸如junit的外部依赖项。

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

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