ivy:publish 如何使用 [classifier] 属性 [英] How does ivy:publish use the [classifier] attribute

查看:28
本文介绍了ivy:publish 如何使用 [classifier] 属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 ivy:publisher 中,默认的交付模式是 ${ivy.distrib.dir}/[type]s/[artifact]-[revision](-[classifier]).[ext]

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

我尝试通过向元素添加属性 e:classifier="" 在我的 ivy.xml 下设置分类器.

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

但是 [classifier] 没有设置?当 ivy:publish 在我的 build.xml 文件中运行时,它看起来是空的,因此不包含在文件名模式中.

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.

推荐答案

我想我已经解决了你的问题.

I think I've figured out your problem.

需要明确的是,确定存储库文件名的是配置的解析器,而不是发布任务.这是我的示例,它在 artifact 和 ivy 文件名模式中使用了两个额外的属性 greetingauthor:

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>

额外属性的值由 ivy.xml 文件决定:

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

这篇关于ivy:publish 如何使用 [classifier] 属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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