<ivy-module version="2.0">
<info organisation="com.travelclick" module="CoreWebServices" revision="4.1"/>
<configurations defaultconfmapping="default">
<conf name="runtime" visibility="public"/>
<conf name="default" visibility="public" extends="runtime"/>
</configurations>
<dependencies>
<dependency org="com.travelclick"
name="commons-all"
rev="4.1"
conf="default->default"/>
<dependency org="com.sun.messaging.mq"
name="jms"
rev="4.5.2"
conf="default->default"/>
<dependency org="org.jboss.common"
name="servlet-api"
rev="4.2"
conf="default->default"/>
<dependency org="com.fiorano"
name="framework"
rev="2.0"
conf="default->default"/>
<dependency org="com.fiorano"
name="fmq-client"
rev="9.3.0"
conf="default->default"/>
<dependency org="commons-codec"
name="commons-codec"
rev="1.3"
conf="default->default"/>
<dependency org="commons-httpclient"
name="commons-httpclient"
rev="3.1"
conf="default->default"/>
<dependency org="commons-lang"
name="commons-lang"
rev="2.2"
conf="default->default"/>
<dependency org="commons-pool"
name="commons-pool"
rev="1.4"
conf="default->default"/>
</dependencies>
</ivy-module>
Note that all dependencies are configured as default->default.
In my build.xml, I have the following statements:
<ivy:resolve conf="default"/>
<ivy:cachepath pathid="all.libs" conf="default"/>
Note I’m using the default configuration.
I use the all.libs path to download the libraries into my war I’m building.
I get the following libraries in my war, which is what I want:
commons-all-4.1.jar
commons-codec-1.3.jar
commons-httpclient-3.1.jar
commons-lang-2.2.jar
commons-logging-1.0.4.jar
commons-pool-1.4.jar
fmq-client-9.3.0.jar
framework-2.0.jar
jms-4.5.2.jar
servlet-api-4.2.jar
Now, I’ll remove the configuration information. This is the same ivy.xml with the <configurations> section removed and all the conf=default->default removed:
<ivy-module version="2.0">
<info organisation="com.travelclick" module="CoreWebServices" revision="4.1"/>
<dependencies>
<dependency org="com.travelclick"
name="commons-all"
rev="4.1"/>
<dependency org="com.sun.messaging.mq"
name="jms"
rev="4.5.2"/>
<dependency org="org.jboss.common"
name="servlet-api"
rev="4.2"/>
<dependency org="com.fiorano"
name="framework"
rev="2.0"/>
<dependency org="com.fiorano"
name="fmq-client"
rev="9.3.0"/>
<dependency org="commons-codec"
name="commons-codec"
rev="1.3"/>
<dependency org="commons-httpclient"
name="commons-httpclient"
rev="3.1"/>
<dependency org="commons-lang"
name="commons-lang"
rev="2.2"/>
<dependency org="commons-pool"
name="commons-pool"
rev="1.4"/>
</dependencies>
</ivy-module>
Naturally, I also have to change by build.xml to remove references to the default configuration:
<ivy:resolve/>
<ivy:cachepath pathid="all.libs"/>
But, now look what gets included:
commons-all-4.1.jar
commons-codec-1.3.jar
commons-httpclient-3.1.jar
commons-lang-2.2.jar
commons-logging-1.0.4.jar
commons-pool-1.4.jar
fmq-client-9.3.0.jar
framework-2.0.jar
jms-4.5.2.jar
servlet-api-4.2.jar
commons-httpclient-3.1-sources.jar
commons-codec-1.3-javadoc.jar
commons-codec-1.3-sources.jar
commons-lang-2.2-javadoc.jar
commons-lang-2.2-sources.jar
commons-pool-1.4-sources.jar
Why, when I set everything to default, only the actual jars downloaded and not the source and javadoc jars. Yet, when I removed all configuration, the javadoc and source jars also downloaded.
In fact, where is the configuration of the various jars in the Maven repository stored? I can see the javadoc and source in the Maven repository, but I didn’t see anything about various configurations. How does Ivy know whether or not to include the sources and javadoc jars?
There is no standard default configuration in ivy. Each ivy file defines its own set of
confs in the<configuration> ..</configuration>section.In your first example you defined
defaultand mapped it to thedefaultconfiguration of your artifacts. These dependencies are maven artifacts and ivy maps a maven scope todefault(Ivy reads the maven pom file and creates an ivy file for that in the cache). So basically you were just lucky, that thedefaultconf existed in the ivy file for the configuration.The conf
defaultis a mapped maven scope and does not exist as a pre-defined standardconfin ivy.In your second example you omit the
conf="default->default", which is equivalent toconf="*->*"and means: map everything in the dependency to everyconfin this ivy file.This question answers how ivy maps maven scopes to ivy configurations.
In Short:
defaultmaps to the maven scope default which just references the jar*, which references all available configurations and therefore all available maven artifacts.