常春藤无法下载位于本地Maven仓库中的工件的依赖项 [英] Ivy cannot download dependencies of artifact located in a local Maven repostiory

查看:63
本文介绍了常春藤无法下载位于本地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>

这篇关于常春藤无法下载位于本地Maven仓库中的工件的依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆