常春藤 - 解决相同的依赖两次(有两个不同的版本),以两个不同的文件 [英] Ivy - resolve same dependency twice (with two different versions), to two different files

查看:225
本文介绍了常春藤 - 解决相同的依赖两次(有两个不同的版本),以两个不同的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个特殊的情况下,我需要打包了一些罐子,我需要一个罐子的两个版本。我常青藤的定义是这样的:

I have a special situation where I need to package up some jars, and I need BOTH versions of a jar. My ivy definitions looks like this:

<dependency org="blah" name="blahname" rev="1.0.0" conf="baseline->default" />

我想解决了两次,一次是与1.0.0版本,另一个与发言权2.0.0版本相同的依赖。那可能吗?什么是实现这一目标的最简单的方法。

I would like the same dependency resolved twice, once with version 1.0.0 and another with say version 2.0.0. Is that possible? What's the easiest way to achieve this.

推荐答案

使用常春藤配置,创建和管理依赖自定义组。

Use ivy configurations to create and manage custom groups of dependencies.

<ivy-module version="2.0">
    <info organisation="com.myspotontheweb" module="demo"/>

    <configurations>
        <conf name="group1" description="First group of dependencies"/>
        <conf name="group2" description="Second group of dependencies"/>
    </configurations>

    <dependencies>
        <dependency org="commons-lang" name="commons-lang" rev="2.6" conf="group1->default"/>
        <dependency org="commons-lang" name="commons-lang" rev="2.0" conf="group2->default"/>
    </dependencies>

</ivy-module>

的build.xml

<project name="demo" default="resolve" xmlns:ivy="antlib:org.apache.ivy.ant">

    <target name="resolve">
        <ivy:resolve/>

        <ivy:retrieve pattern="lib/[conf]/[artifact]-[revision].[ext]"/>
    </target>

</project>

注:


  • 本例使用检索任务来填充lib目录。又见cachepath和cachefileset任务。

lib目录中填充所需的罐子。

Lib directory is populated with the desired jars.

$ tree
.
|-- build.xml
|-- ivy.xml
`-- lib
    |-- group1
    |   `-- commons-lang-2.6.jar
    `-- group2
        `-- commons-lang-2.0.jar

这篇关于常春藤 - 解决相同的依赖两次(有两个不同的版本),以两个不同的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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