views:

28

answers:

2

http://ant.apache.org/ivy/history/latest-milestone/concept.html

Ivy dependency has an attribute called "color"

What is the use of this attribute? How can we use it in realtime. can some one give me some example.

+1  A: 

Ivy doesn't support an attribute called "color" instead it provides the ability to define any arbitrary additional attributes for an artifact.

This enables more flexibility then defining the naming convention for an artifact in an ivy repository and when using the ivy retrieve task. Here's a contrived example

In practice, if you're downloading from a Maven repo, you won't be able to use this functionality.

Mark O'Connor
A: 

Check out the Ivy documentation on "Extended Attributes". http://ant.apache.org/ivy/history/2.0.0-beta2/concept.html

Qutoed from the docs below...

Example: Here is an ivy file with the attribute 'color' set to blue:

<ivy-module version="2.0" xmlns:e="http://ant.apache.org/ivy/extra"&gt;
    <info organisation="apache"
           module="foo"
           e:color="blue"
           status="integration"
           revision="1.59"
    />
</ivy-module>

Then you must use the extra attribute when you declare a dependency on foo. Those extra attributes will indeed be used as identifier for the module like the org the name and the revision:

<dependency org="apache" name="foo" e:color="blue" rev="1.5+" />

And you can define your repository pattern as:

${repository.dir}/[organisation]/[module]/[color]/[revision]/[artifact].[ext]

Note that in patterns you must use the unqualified attribute name (no namespace prefix).

If you don't want to use xml namespaces, it's possible but you will need to disable ivy file validation, since your files won't fulffill anymore the official ivy xsd. See the settings documentation to see how to disable validation.

Clint Modien
so this is same "conf"${repository.dir}/[organisation]/[module]/[conf]/[revision]/[artifact].[ext]
Angrezy
if you define conf as an extended attribute just like color was defined above... that should work.
Clint Modien