【问题标题】:IVY How to find specific dependency configuration is in use?IVY如何查找特定的依赖配置正在使用中?
【发布时间】:2012-06-18 11:18:42
【问题描述】:

我的 version.xml 在我定义了所有 IVY 配置和依赖项的项目中。我使用 ANT 脚本下载和检索人工制品,到目前为止一切正常。

我正在寻找的是,无论如何我都可以找到 version.xml 中是否存在某些配置,并且某些依赖项被配置为从 ANT 脚本中使用它,例如检查是否我想做一些额外的东西配置其他明智的只是跳过。例如我的 version.xml 如下所示;

<?xml-stylesheet type="text/xsl" href="http://repository.temenosgroup.com/xsl/version-doc.xsl"?>
<ivy-module version="2.0" xmlns:e="http://ant.apache.org/ivy/extra">
    <info organisation="TEMENOS" branch="MAIN" module="StateEngine" />
    <!-- "war->compile(*)" this means the 'war' configuration depends on the
    'compile' configuration of the dependency and if the dependency is not
    found in 'compile' then use the 'default' (same as '*') config (usually that is all dependencies) -->
    <configurations defaultconfmapping="test->test(*);compile->compile(*);componentDep->componentDep(*)">
        <conf name="test" description="Test Time dependencies"/>
        <conf name="compile" description="Build Time dependencies"/>
       <conf name="componentDep" description="To resolve component level dependencies" />
    </configurations>
    <publications>
        <artifact name="#SERVICE_NAME#" type="" ext="zip" />
        <artifact name="#SERVICE_NAME#" type="" ext="zip" e:platform="#PLATFORM_WIN#" />
        <artifact name="#SERVICE_NAME#" type="" ext="zip" e:platform="#PLATFORM_UNIX#" />
    </publications>
    <dependencies>
        ....
        <!-- Define Component Level Dependencies Below -->
        <dependency org="TEMENOS" branch="MAIN" name="StateMachine" transitive="false" rev="latest-dev" conf="componentDep" >
            <artifact name="StateMachineService" ext="zip" e:platform="#PLATFORM_WIN#" type="" conf="componentDep" />
            <artifact name="StateMachineService" ext="zip" e:platform="#PLATFORM_UNIX#" type="" conf="componentDep" />
            <artifact name="StateMachineService" ext="zip" type="" conf="componentDep" /> 
        </dependency>
    </dependencies>
</ivy-module>

那么,在 ANT 中是否有任何可用的目标,例如“ivy:...”,它可以返回“true”或“false”,如何告诉我有一个依赖项正在尝试使用名为“componentDep”的配置?这样我就可以做额外的事情了……否则跳过。我不想在 ANT 中自己解析文件,因为这不是一个好主意。

注意:我使用的是 ANT 1.8.2 和 IVY 2.2.0

希望我说得通。如果您需要更多信息,请告诉我。

谢谢,

--

朱尼乔

【问题讨论】:

  • 我已经使用 蚂蚁任务...如果没有定义依赖项,那么路径将为空现在可以用来决定下一步做什么
  • 啊,现在我明白你在问什么了。 Ivy 文件通常会指定项目的依赖项。声明配置然后不使用它会很奇怪.....但是在你的情况下,因为我怀疑你在运行时生成常春藤文件,这成为一种可能性。

标签: ant ivy


【解决方案1】:

Ivy 通常使用一个名为 ivy.xml.....

的文件进行解析

我怀疑您的 version.xml 文件是为替换而设计的?也许您的构建正在运行时生成 ivy 文件?

怀疑原因

ivy 发布的文件名似乎无效....我怀疑你创建了 3 个名为 #SERVICE_NAME#.zip

的文件
<publications>
    <artifact name="#SERVICE_NAME#" type="" ext="zip" />
    <artifact name="#SERVICE_NAME#" type="" ext="zip" e:platform="#PLATFORM_WIN#" />
    <artifact name="#SERVICE_NAME#" type="" ext="zip" e:platform="#PLATFORM_UNIX#" />
</publications>

我认为在您的构建中的其他地方正在进行过滤副本.....

您原来问题的可能答案

我想您正在寻找ivy resolution report?这将创建与每个项目配置关联的文件的 HTML 报告。用法如下:

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

    <ivy:report todir='${ivy.reports.dir}' graph='false' xml='false'/>

     ..
</target>

【讨论】:

    猜你喜欢
    • 2017-03-08
    • 2023-03-07
    • 2023-03-25
    • 2011-07-21
    • 2012-08-29
    • 2013-02-14
    • 2012-02-24
    • 2014-08-08
    • 2015-06-04
    相关资源
    最近更新 更多