问题
I have stuff like this:
<configurations defaultconfmapping="build->default;compile->compile(*),master(*);test,runtime->runtime(*),master(*); statistic->stistic(*)">
in my ivy.xml
and I don't understand the concept of a 'configuration mapping'
Who gets mapped to what?
Why?
What does the (*)
mean?
回答1:
I've been trying to understand this myself for the last few days. I think this is how it works:
"build->default" means that if I ask for all of the "build" dependencies of my jar, then Ivy pulls the "default" version of that dependency from the repository. If instead you say "build->build" or equivalently "build" then Ivy looks for a jar tagged "build" in the repository to satisfy that dependency. I think the main purpose of having multiple tagged artifacts in the repo are to have a "default", "source", "javadoc" and maybe "debug" version of your code.
I make heavy use of "provided->default" to specify jars that I need to compile against, but that I don't need to add to my plugin installer because I know that jar will already be present at runtime because it's provided by a different installer.
回答2:
To my understanding after reading the "dependency" documentation (instead of the "configurations" documentation which IMHO is less clear), a "master configuration" (left side of arrow; i.e. a configuration of the current module) gets mapped to a "dependency configuration" (right side of arrow) in order to determine which configuration(s) of the dependency are required in which configuration(s) of the current module.
Since Ivy 1.3, the dependency configuration may have a fallback listed in parenthesis, and this is allowed to be a wildcard ("*").
来源:https://stackoverflow.com/questions/1578869/what-is-a-configurationmapping-in-ivy