2010-02-17 35 views
5

in ivy:publisher默認deliverrivypattern是$ {ivy.distrib.dir}/[類型] s/[工件] - [修訂]( - [分類器])。 [ext]常春藤:發佈使用[分類器]屬性

我嘗試通過在元素中添加屬性e:classifier =「」在我的ivy.xml中設置分類器。

但[分類器]沒有設置? 當ivy:publish在我的build.xml文件中運行時,它看起來是空的,因此不包含在文件名稱模式中。

回答

5

我想我已經找到了你的問題。

只是要明確它是配置的解析器,它決定了存儲庫文件名,而不是發佈任務。這是我的例子,它採用了兩個額外的屬性問候作者的神器和常春藤名樣式:

<ivysettings> 
    <property name="repo.dir" value="${ivy.basedir}/build/repo"/> 
    <property name="ivy.checksums" value=""/> <!-- Suppress the generation of checksums --> 

    <settings defaultResolver="internal"/> 

    <resolvers> 
     <filesystem name="internal"> 
      <ivy pattern="${repo.dir}/[module]/[author]-ivy(-[greeting])-[revision].xml" /> 
      <artifact pattern="${repo.dir}/[module]/[author]-[artifact]-[greeting]-[revision].[ext]" /> 
     </filesystem> 
    </resolvers> 
</ivysettings> 

額外屬性的值由的ivy.xml文件決定:

<ivy-module version="2.0" xmlns:e="http://ant.apache.org/ivy/extra"> 
    <info organisation="myorg" module="hello" e:author="Mark"/> 
    <publications> 
    <artifact name="English" ext="txt" type="doc" e:greeting="hello"/> 
    <artifact name="Irish" ext="txt" type="doc" e:greeting="dia_dhuit"/> 
    <artifact name="Spanish" ext="txt" type="doc" e:greeting="Hola"/> 
    </publications> 
</ivy-module> 

果然,當我發表的問候和作者變量的值存在的文件:

$ find build -type f 
build/repo/hello/Mark-English-hello-1.0.txt 
build/repo/hello/Mark-Irish-dia_dhuit-1.0.txt 
build/repo/hello/Mark-Spanish-Hola-1.0.txt 
build/repo/hello/Mark-ivy-1.0.xml 
1

我相信你想要的模式是這樣的。如果問候沒有被定義,它將被排除。

[作者] - [神器]( - [問候]) - [修改] [轉]

+0

感謝您的非常正確我會更新我的發佈 –

1

我面臨着同樣的問題,我們找到了一種方法,以獲得額外的屬性

我在ivysettings.xml變成類似例子...

<resolvers> 
<filesystem name="internal"> 
    <ivy pattern="${repo.dir}/[module]/[author]-ivy(-[greeting])-[revision].xml" /> 
    <artifact pattern="${repo.dir}/[module]/[author]-[artifact]-[greeting]-[revision].[ext]" /> 
</filesystem> 

,並在您的ivy.xml文件,我把以下內容:請注意,我想問候值是動態值,每次我發佈的東西($ {someValue中}

<ivy-module version="2.0" xmlns:e="http://ant.apache.org/ivy/extra"> 
<info organisation="myorg" module="hello" e:author="Mark"/> 
<publications> 
    <artifact name="English" ext="txt" type="doc" e:greeting="${someValue}"/> 
</publications> 

這裏就是招進來 - >在我的生成文件,其中我所說的常春藤:發佈功能,以下屬性已被設置爲true(forcedeliver

<ivy:publish resolver="@{ivy.resolver}" 
     pubrevision="@{publish.revision}" 
     status="@{status}" 
     forcedeliver="true" 
     overwrite="@{overwrite}" 
     update="true" /> 

就是這樣

2

我有一個問題機智^ h

屬性分類是不允許出現在元素「神器」

我只是增加了「額外」的命名空間在我的聲明,並能夠使用分類。

<ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd" 
     xmlns:e="http://ant.apache.org/ivy/extra"> 

    <dependency org="orphans" name="vaadin-timeline-cval" rev="2.0"> 
     <artifact name="vaadin-timeline-cval" e:classifier="1.3.1" ext="jar"/> 
    </dependency>