First of all, Ivy is not Maven ;)
Maven2 is a project and software management tool, while Ivy is just a dependency management tool.
Ivy relies heavily on a unique concept .
In ivy, a module configuration is a way to use or view a module .
For example, you may have a test and runtime configuration in your module. But you can also have mysql and oracle configuration. Or sleep mode and jdbc configuration.
In each configuration, you can declare:
- what artifacts (jar, war, ...) are required.
- your dependencies on other modules and indicate which configuration is up to you. This is called a configuration mapping.
Thus, the conf attribute does just that: Describes the configuration mapping for a dependency.
the displayed child is your "right side of the character -> " and is the name of the displayed dependency configuration. The wildcard character '*' can be used to indicate all configurations of this module.
Maven2 for its part has something called an area .
You can declare a dependency as part of a validation area or build time area.
Then, depending on this area, you will get a dependency artifact (only one artifact for each module in maven2) with its dependencies depending on their volume. Scopes are predefined in maven2, and you cannot change this.
It means:
Many libraries have many unnecessary dependencies loaded.
For example, Hibernate loads a bunch of JBoss JARs, and Display Tag loads all the various JARs in the web. I found that I eliminate almost as many dependencies as I added.
The problem is that hibernation can be used with multiple cache implementations, multiple connection pool implementations ... And this cannot be implemented using areas where Ivy configurations offer an elegant solution to this problem.
For example, in plus , assuming hibernate has an ivy file like this , then you can declare a dependency like this :
<dependency org="hibernate" name="hibernate" rev="2.1.8" conf="default->proxool,oscache"/>
to get hibernation with its proxool and oscache implementations, and like this:
<dependency org="hibernate" name="hibernate" rev="2.1.8" conf="default->dbcp,swarmcache"/>
to get hibernation using dbcp and swarmcache.
By mapping the default configuration of master to " proxool,oscache " or to " dbcp,swarmcache ", you determine exactly what you need from the "hibernate" module.
You can find these arguments "proxool, ..." by specifying the ivy configuration defined for each module associated with the library. For example:
<ivy-module version="2.0"> <info organisation="ssn-src" module="pc"/> <configurations defaultconfmapping="default->default"> <conf name="default" /> <conf name="provided" description="they are provided by the env." /> <conf name="compile" extends="default,provided" /> <conf name="war" extends="default"/> </configurations> <dependencies>
An example :
suppose modA has two configurations, the default and the test.
In practical terms, it is very unusual to want to leave the conf attribute of the dependency element.
ivy.xml for modA may have a dependency:
<dependency org="theteam" name="modB" rev="1.0" conf="default->*" />
You start with a default value, not both the default and the test.
The above example makes modA default dependent on modB conf1, conf2 and conf3.
Or you can say that the default modA value depends only on modB conf1:
<dependency org="theteam" name="modB" rev="1.0" conf="default->*conf1*" />