You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-user@ant.apache.org by Adam Mlodzinski <Ad...@quest.com> on 2011/12/01 17:35:28 UTC

Purpose of artifact ext attribute

Hi there,

I'm just getting started with ivy, and I have many questions. Most have been answered by the docs, and some by searching the web. But, there's one thing I don't understand:

What is the purpose of separating the 'ext' from the artifact 'name'? I mean, why is 'ext' a separate thing at all? It's clearly distinct from the artifact 'type', but I fail to see why it's been made distinct from the artifact name. Can I safely ignore it or use an empty string when defined in ivy.xml, and not use [ext] at all in my build (ivy:publish) files?

Case in point: mystuff.tar.gz.

Is the 'name' = "mystuff", with an extension "tar.gz"?
Or, is the 'name' = "mystuff.tar", with an extension "gz"?
Or, is the 'name' = "mystuff.tar.gz", and the extension irrelevant?

I think all are correct, conceptually. But it looks like ivy would have trouble handling the first one - at least, coming up with a pattern to match it would be not obvious.



P.S.
I hate to pile on more than one question, but these are so minor, I really don't want to start separate threads for them:
Where do the docs explain that a physical artifact path is parsed to provide values for the bracketed portions of the artifactpattern? Do the docs point out that all such bracketed expressions in ivy:publish are matched against corresponding attributes defined in ivy.xml  - and that the names generally match, except for [artifact], which is matched against the artifact elements' "name" attribute?
I couldn't find this information.



RE: Purpose of artifact ext attribute

Posted by Adam Mlodzinski <Ad...@quest.com>.
> From: Mitch Gitman [mailto:mgitman@gmail.com]

Thanks for the quick reply :) It looks like activity on this mailing list is slowing down recently.


 
> You want the artifact's simple name and the extension separate because,
> for
> one thing, typically when you go to publish the artifact you'll be
> inserting the revision into the filename. The actual filename won't be
> foo.jar, it will be something like foo-1.0-20111201114253.jar.
> 
> Your example of mystuff.tar.gz is a case of where you want
> ext="tar.gz".
> Then you can publish something like:
> mystuff-SNAPSHOT.tar.gz
> The "-SNAPSHOT" version suffix gets inserted now in the right place
> because
> the tar part is part of the extension.


I see. So, if I'm publishing files whose names do not include a revision, where the revision information is managed by a separate repository manager (or is part of the publish-target directory structure, for example), then I suppose the 'ext' setting could be optional.

Hmmm. Actually, I don't quite see. Are you saying that the ivy:publish task will modify the name of the file that I publish? Or, is it that the revision value can be parsed from the filename that I publish?
For example, if I publish a file in "builds/products/theproduct-1.0.0.exe" using an artifactspattern of "builds/[type]s/[artifact]-[version].[ext]", then ivy-module:artifact restricts the match to files ending with specified ext, specified artifact name and specified artifact type.... but don't I also have to specify version then, using e:version possibly? Or, will ivy match the [version] for me and use that as metadata for the published archive?
I think I have to specify all parts of the artifact pattern, don't I? 




Would it be fair to say that the artifact 'name' corresponds to the 'revision-prefix', while the 'ext' corresponds to the 'revision-suffix'? Well, except for the inability to control the characters prepended and appended to the revision itself ('-' and '.', I presume).


I understand how type can be used to infer the ext, but since 'type' is not otherwise related, I'd rather keep it out of this discussion as it merely adds confusion instead of helping.

Re: Purpose of artifact ext attribute

Posted by Mitch Gitman <mg...@gmail.com>.
You want the artifact's simple name and the extension separate because, for
one thing, typically when you go to publish the artifact you'll be
inserting the revision into the filename. The actual filename won't be
foo.jar, it will be something like foo-1.0-20111201114253.jar.

Also, there's the additional parameter of type, where by default the ext
value is taken from the type. You might have:
<artifact name="foo" type="jar" />
<artifact name="foo-source" type="source" ext="jar" />

Here's a case where you have a common extension, one of which is implied by
the type, but two different types.

Your example of mystuff.tar.gz is a case of where you want ext="tar.gz".
Then you can publish something like:
mystuff-SNAPSHOT.tar.gz
The "-SNAPSHOT" version suffix gets inserted now in the right place because
the tar part is part of the extension.

I'll let someone else field the P.S.

On Thu, Dec 1, 2011 at 8:35 AM, Adam Mlodzinski
<Ad...@quest.com>wrote:

> Hi there,
>
> I'm just getting started with ivy, and I have many questions. Most have
> been answered by the docs, and some by searching the web. But, there's one
> thing I don't understand:
>
> What is the purpose of separating the 'ext' from the artifact 'name'? I
> mean, why is 'ext' a separate thing at all? It's clearly distinct from the
> artifact 'type', but I fail to see why it's been made distinct from the
> artifact name. Can I safely ignore it or use an empty string when defined
> in ivy.xml, and not use [ext] at all in my build (ivy:publish) files?
>
> Case in point: mystuff.tar.gz.
>
> Is the 'name' = "mystuff", with an extension "tar.gz"?
> Or, is the 'name' = "mystuff.tar", with an extension "gz"?
> Or, is the 'name' = "mystuff.tar.gz", and the extension irrelevant?
>
> I think all are correct, conceptually. But it looks like ivy would have
> trouble handling the first one - at least, coming up with a pattern to
> match it would be not obvious.
>
>
>
> P.S.
> I hate to pile on more than one question, but these are so minor, I really
> don't want to start separate threads for them:
> Where do the docs explain that a physical artifact path is parsed to
> provide values for the bracketed portions of the artifactpattern? Do the
> docs point out that all such bracketed expressions in ivy:publish are
> matched against corresponding attributes defined in ivy.xml  - and that the
> names generally match, except for [artifact], which is matched against the
> artifact elements' "name" attribute?
> I couldn't find this information.
>
>
>