views:

929

answers:

1

I am in the process of reviewing the use of Ivy in our application. I have set up a simple configuration to pull down cobertura.

<ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd"&gt;
    <info
        organisation="com"
        module="adesa"
        status="integration">
    </info>
    <configurations>
        <conf name="runtime" description=""/>
    </configurations>
    <dependencies>
      <dependency org="cobertura" name="cobertura" rev="1.8" transitive="true"/>
    </dependencies> 
</ivy-module>

I know that cobertura has dependencies on other jar files. So how does one get those other jar files? The only thing that I see in my cache directory is the cobertura jar file.

Here is my ivysetting.xml

<ivysettings>
<settings defaultResolver="chained" />
<resolvers>
 <chain name="chained" returnFirst="true"> 
  <url name="apache" m2compatible="true"> 
   <!--Apache -->
      <artifact pattern="http://repo1.maven.org/maven2/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
      <artifact pattern="http://people.apache.org/repo/m2-incubating-repository/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
  </url>
  <url name="jboss" m2compatible="true"> 
      <!-- JBoss -->
      <artifact pattern="http://repository.jboss.com/maven2/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
  </url>

  <ibiblio name="ibiblio" m2compatible="true" /> 
     <url name="mvnrepos" m2compatible="true">
      <!-- IBIBLIO-Mirror -->
   <artifact pattern="http://mirrors.ibiblio.org/pub/mirrors/maven2/[organisation]/[module]/[branch]/[revision]/[branch]-[revision].[ext]" />
  </url>
 </chain> 
</resolvers>

Are there list of other repositories that can be used to get dependencies/jars?


Snippet from the build.xml file:

    <target name="load-ivy">
 <path id="ivy.lib.path">
  <fileset dir="${basedir}/lib" includes="*.jar"/>
 </path>
 <taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
</target>

<target name="ivy-init" depends="load-ivy">
 <mkdir dir="${dest.repo.dir}"/>
 <ivy:settings id="basic.settings" file="${basedir}/ivysettings.xml"/>
</target>

<target name="ivy-clean" depends="ivy-init">
 <ivy:cleancache settingsRef="basic.settings"/>
 <delete dir="${ivy.cache.dir}" failonerror="true"  />
 <delete dir="${dest.repo.dir}"/>
</target>


<target name="ivy-download" depends="ivy-clean,ivy-init">
 <ivy:retrieve  settingsRef="basic.settings" pattern="${dest.repo.dir}/[artifact]/[artifact]-[revision].[ext]" />
</target>

<target name="ivy-report" depends="ivy-download">
 <ivy:report  settingsRef="basic.settings" todir="${basedir}/logs" />
</target>
+2  A: 

Your conf looks very similar to mine, except I have a different dependency for cobertura:

<dependency org="net.sourceforge.cobertura" name="cobertura" rev="1.9" conf="cobertura"/>


Also I suggest that you try with the default ivysettings.xml before adding extra repositories.


Sample snippets

Ivy classpath resolution:

<target name="init.deps" description="Download (if needed) and resolve the dependencies." unless="deps.init">

 <taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpath="${ivy.jar.file}" />

 <ivy:resolve />
 <ivy:cachepath pathid="ivy.path" conf="production" />

 <property name="deps.init" value="true"/> <!-- guard against multiple ivy computations -->

</target>

Use ivy path for compilation

<target name="compile" depends="init, record-build-number">
 <javac srcdir="src" debug="true" destdir="build/classes">
  <classpath>
   <path refid="ivy.path" />
  </classpath>
 </javac>
</target>
Robert Munteanu
I am not using ivy:resolve - maybe that is my issue.
boyd4715
using your setting I always get: impossible to resolve dependencies: message.I removed any reference to the ivysettings.xml and see in the output that a default instance will be used message.
boyd4715
How do you invoke ivy them?
Robert Munteanu
I have edited orig message with part of my build file. I modified my ivysettings.com with a new pattern for the mvnrepps which allowed me to use your dependency. <url name="mvnrepos" m2compatible="true"> <!-- IBIBLIO-Mirror --> <artifact pattern="http://mirrors.ibiblio.org/pub/mirrors/maven2/[organisation]/[module]/[branch]/[revision]/[branch]-[revision].[ext]" /> <artifact pattern="http://mirrors.ibiblio.org/pub/mirrors/maven2/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" /> </url>
boyd4715
Where are you placing the ivy:resolve? Can you post back the structure of your build.xml and ivy.xml as a reference model?
boyd4715
@boyd4715 - see my update for build.xml sinppets
Robert Munteanu
Thanks, I added the following to my ivy.xml file: <configurations> <conf name="default" transitive="true" description=""/> </configurations>and that seems to do the trick of bring down all the dependences
boyd4715