Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
662 views
in Technique[技术] by (71.8m points)

ant - How does ivy:publish use the [classifier] attribute

in ivy:publisher the default deliverivypattern is ${ivy.distrib.dir}/[type]s/[artifact]-[revision](-[classifier]).[ext]

I try to set classifier in my ivy.xml under by adding attribute e:classifier="" to the element.

But the [classifier] does not get set? When ivy:publish runs in my build.xml file it appears to be empty and thereby not included in the file name pattern.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I think I've figured out your problem.

Just to be clear it is the configured resolver that determines the repository filename and not the publish task. Here's my example, which utilises two extra attributes greeting and author in the artifact and ivy filename patterns:

<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>

The values of the extra attributes are determined by the ivy.xml file:

<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>

Sure enough when I published the files the values of the greeting and author tags were present:

$ 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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...