2
votes

I tried to configure Ivy to download source code for dependencies. It works, but only for the top-level dependency. Maven will get sources for all levels of dependencies. How can I do this using Ivy?

Here is my ivy.xml file:

<ivy-module version="2.0">
    <info organisation="com.ubs" module="IMQuant"/>
    <dependencies defaultconfmapping="*->default,sources">
        <dependency org="junit" name="junit" rev="4.11"/>
        <dependency org="org.apache.maven.surefire" name="common-java5" rev="2.17"/>
        <dependency org="com.googlecode.kevinarpe-papaya" name="kevinarpe-papaya" rev="0.0.15"/>
    </dependencies>
</ivy-module>

Here is my retreive statement:

<ivy:retrieve pattern="${libs.dir}/ivy/all/[artifact]-[revision]-[type].[ext]" />

Above, dependency kevinarpe-papaya requires Google Guava. I see the JAR downloaded (actually a bundle), but I don't see the sources. I checked my Ivy cache. The sources are also missing for Google Guava.

Also, dependency junit requires Hamcrest (core). Again, I see the JAR downloaded, but I don't see the sources. (Also, I checked my Ivy cache.)

1

1 Answers

1
votes

You could try to specify the type:

type="sources"

E.g.:

<dependency org="junit" name="junit" type="sources" rev="4.11"/>

If you want to retrieve different types, mention the same dependendy multiple times:

<dependency org="junit" name="junit" type="sources" rev="4.11"/>
<dependency org="junit" name="junit" type="jar" rev="4.11"/>