2012-06-15 20 views
0

我有我的version.xml在一個項目中,我定義了所有的IVY配置和依賴關係。我使用ANT腳本下載和檢索文物,到目前爲止一切正常。IVY如何查找特定的依賴項配置正在使用中?

我在尋找的是,無論如何,我可以找到如果某些配置存在於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提供的任何目標,如「常春藤:......」,這可以返回「真」或「假」一些如何告訴我,有正試圖使用​​配置叫做依賴'componentDep'?這樣我可以做我額外的東西..其他方式跳過。我不想在ANT中自己解析文件,因爲這不是一個好主意。

注:我使用ANT 1.8.2和2.2.0 IVY

希望我做的意義。如果您需要更多信息,請告訴我。

感謝,

-

Sjunejo

+0

我一直在使用做到了<常青藤:cachepath PATHID =「ivy.cache.path」 CONF =「componentDep」 /> Ant任務......如果有則定義沒有依賴的路徑是空的,現在可以用來決定下一步做什麼 – SJunejo

+0

啊,現在我明白你在問什麼了。常春藤文件通常會指定項目的依賴關係。聲明一個配置然後不使用它會是很奇怪的......但是在你的情況下,因爲我懷疑你是在運行時生成常青藤文件,這成爲一種可能性。 –

回答

2

常春藤解析通常使用一種稱爲的ivy.xml文件.....

我懷疑你version.xml文件旨在替換?也許你的構建是在運行時生成常青藤文件?

理由懷疑

常春藤公佈的文件的名字沒有出現有效的....我懷疑你creatung 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> 
相關問題