常春藤无法下载位于本地Maven仓库中的工件的依赖项
我在本地Maven存储库中安装了工件A.
I have an artifact A installed in a local Maven repository.
工件A具有许多依赖性-在其pom中已正确指定.
Artifact A has a number of dependencies - properly specified in its pom.
如果我在Maven项目中将A设置为依赖项,则一切正常-A及其依赖项均已正确下载.这说明我已经在本地Maven存储库中正确安装了A,并且已经正确指定了其依赖项.
If I set A as a dependency in a Maven project everything is ok - both A and its dependencies are correctly downloaded. This tells me that A is properly installed in the local Maven repo, and that its dependencies have been properly specified.
我也有一个Ant/Ivy项目.我已经按照以下方式配置了ivysettings.xml(遵循从另一个答案中获得的建议):
I also have a Ant/Ivy project. I have configured ivysettings.xml in the following way (following advice taken from another answer):
<ivysettings>
<settings defaultResolver="default"/>
<property name="m2-pattern" value="${user.home}/.m2/repository/[organisation]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]" override="false" />
<resolvers>
<chain name="default">
<filesystem name="local-maven2" m2compatible="true" >
<artifact pattern="${m2-pattern}"/>
<ivy pattern="${m2-pattern}"/>
</filesystem>
<ibiblio name="central" m2compatible="true"/>
</chain>
</resolvers>
</ivysettings>
使用此配置,Ivy会正确下载A,但不会正确下载其依赖项(似乎完全忽略了其pom文件).
With this configuration, Ivy correctly downloads A, but not its dependencies (seems to completely ignore its pom file).
我该如何更改我的设置,以使依赖项也将被下载?
How should I have to change my setup in such a way dependencies as well will be downloaded?
尽管Mark O'Connor的答案是正确的答案,并且是解决问题的合理方法,但我设法找到了另一种解决方案,这意味着imo的开销较小.设置条款.
Although Mark O'Connor answer is a proper answer and a reasonable way to solve the problem, I managed to find a different solution which implies imo a lesser overhead in terms of setup.
因此,我通过Ant任务ivy:convertpom
将工件A的POM转换为Ivy文件.请注意,与POM标准相反,常春藤文件应命名为:ivy-<your lib revision>.xml
.
So, I converted the POM of artifact A to an Ivy file - via the Ant task ivy:convertpom
. Note that, contrary to the POM standard, the Ivy file should be named as follows: ivy-<your lib revision>.xml
.
然后,我刚刚配置了一个本地 Ivy 存储库,该存储库指向工件A及其Ivy文件所在的文件夹,例如:
Then, I just configured a local Ivy repository pointing to the folder where the artifact A and its Ivy file are located, such as:
<ivysettings>
<property name="my-local-ivy-dependencies-jars.repository" value="${user.dir}\..\my-local-ivy-dependencies-jars/lib"/>
<property name="my-local-ivy-dependencies-jars.pattern" value="${my-local-ivy-dependencies-jars.repository}/[organisation]/jars/[artifact]-[ revision].[ext]"/>
<settings defaultResolver="default"/>
<resolvers>
<chain name="default">
<filesystem name="my-local-ivy-dependencies-jars">
<ivy pattern="${my-local-ivy-dependencies-jars.pattern}" />
<artifact pattern="${my-local-ivy-dependencies-jars.pattern}" />
</filesystem>
<ibiblio name="central" m2compatible="true"/>
</chain>
</resolvers>
</ivysettings>