3

I have a java project setup and wanted to use ivy as dependency management tool. However, I could not get the simplest one to work.

Here is the code I have:

ivy.xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
    <info
        organisation="de.fau.fsahoy"
        module="de.fau.fsahoy.android.api15"
        status="integration">
    </info>

    <dependencies>
        <dependency org="org.restlet.android" name="org.restlet" rev="2.1-RC5"/>
    </dependencies>
</ivy-module>

ivysettings.xml

<?xml version="1.0"?>
<ivysettings >
    <settings defaultResolver="maven" />
    <resolvers>
        <chain name="maven" returnFirst="true">
            <ibiblio name="restlet" m2compatible="true" root="http://maven.restlet.org/" />
        </chain>
    </resolvers>

</ivysettings>

The errors I get are:

Impossible to resolve dependencies of de.fau.fsahoy#de.fau.fsahoy.android.api15;working@JonasErl-PC

Failed to load the descriptor for ivysettings.xml[*] in fsahoy-team-d-gitThe ivy file 'C:\Users\JonasErl\Code\fsahoy-team-d-git\ivysettings.xml' could not be parsed: null in file:/C:/Users/JonasErl/Code/fsahoy-team-d-git/ivysettings.xml


org.apache.ivyde.eclipse.IvyDEException: The ivy file 'C:\Users\JonasErl\Code\fsahoy-team-d-git\ivysettings.xml' could not be parsed: null in file:/C:/Users/JonasErl/Code/fsahoy-team-d-git/ivysettings.xml
    at org.apache.ivyde.eclipse.CachedIvy.getModuleDescriptor(CachedIvy.java:376)
    at org.apache.ivyde.eclipse.resolve.IvyResolveJob.run(IvyResolveJob.java:137)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: java.text.ParseException: null in file:/C:/Users/JonasErl/Code/fsahoy-team-d-git/ivysettings.xml
    at org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser$Parser.parse(XmlModuleDescriptorParser.java:301)
    at org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser.parseDescriptor(XmlModuleDescriptorParser.java:116)
    at org.apache.ivy.plugins.parser.ModuleDescriptorParserRegistry.parseDescriptor(ModuleDescriptorParserRegistry.java:88)
    at org.apache.ivy.plugins.parser.AbstractModuleDescriptorParser.parseDescriptor(AbstractModuleDescriptorParser.java:48)
    at org.apache.ivyde.eclipse.CachedIvy.getModuleDescriptor(CachedIvy.java:368)
    ... 2 more
Caused by: java.lang.NullPointerException

You can have a look at the repository structure at maven.restlet.org

These errormessages are not the very best unfortunately. How can I fix this?

Jonas Gröger
  • 1,558
  • 2
  • 21
  • 35

1 Answers1

1

I could not reproduce your error....

  • What version of ivy are you using?
  • How are you invoking the ivy tasks?

Test

build.xml

<project name="demo" default="init" xmlns:ivy="antlib:org.apache.ivy.ant">

    <target name="init">
        <ivy:resolve/>
    </target>

    <target name="clean">
        <ivy:cleancache/>
    </target>

</project>

Build output

init:
[ivy:resolve] :: Apache Ivy 2.3.0-rc1 - 20120416000235 :: http://ant.apache.org/ivy/ ::
[ivy:resolve] :: loading settings :: file = /home/mark/tmp/ivysettings.xml
[ivy:resolve] :: resolving dependencies :: de.fau.fsahoy#de.fau.fsahoy.android.api15;working@mark-laptop
[ivy:resolve]   confs: [default]
[ivy:resolve]   found org.restlet.android#org.restlet;2.1-RC5 in restlet
[ivy:resolve] downloading http://maven.restlet.org/org/restlet/android/org.restlet/2.1-RC5/org.restlet-2.1-RC5.jar ...
[ivy:resolve] ..............................................................................................................................................................................................................................................................................................................................................................................................
[ivy:resolve] ................ (699kB)
[ivy:resolve] .. (0kB)
[ivy:resolve]   [SUCCESSFUL ] org.restlet.android#org.restlet;2.1-RC5!org.restlet.jar (1880ms)
[ivy:resolve] downloading http://maven.restlet.org/org/restlet/android/org.restlet/2.1-RC5/org.restlet-2.1-RC5-sources.jar ...
[ivy:resolve] ............................................................................................................................................................................................................................................................................................................................................................................................................................................................... (738kB)
[ivy:resolve] .. (0kB)
[ivy:resolve]   [SUCCESSFUL ] org.restlet.android#org.restlet;2.1-RC5!org.restlet.jar(source) (971ms)
[ivy:resolve] :: resolution report :: resolve 1713ms :: artifacts dl 2864ms
    ---------------------------------------------------------------------
    |                  |            modules            ||   artifacts   |
    |       conf       | number| search|dwnlded|evicted|| number|dwnlded|
    ---------------------------------------------------------------------
    |      default     |   1   |   1   |   1   |   0   ||   2   |   2   |
    ---------------------------------------------------------------------
Mark O'Connor
  • 76,015
  • 10
  • 139
  • 185
  • Thank you. Now the resolving works. However, it does not automatically add it as source and the android sdk is also not working. – Jonas Gröger Jul 08 '12 at 17:30
  • 1
    @JonasGröger Sorry I don't understand. "add it as source"? Sounds like a new question. – Mark O'Connor Jul 09 '12 at 19:19
  • Yes somehow :) It downloads all the jars, like restlet.jar, restlet.src.jar and restlet.javadoc.jar. However, it does not add src and javadoc to the restlet.jar for completion and hover to see documentation and so on. – Jonas Gröger Jul 09 '12 at 21:06
  • 1
    @JonasGröger Definately a second question. A quick answer attempt:....You need to include a configuration mapping on the ivy dependency, for example: conf="default". This will restrict the list of dependencies to those needed for compilation. I still don't understand the second part about adding to the restlet.jar and hovering.... Ivy doesn't change the dependencies in anyway, merely downloads them from remote repository. – Mark O'Connor Jul 09 '12 at 21:23
  • Thank you for your help :) Every question was answered. Thanks also for the hint to configurations. – Jonas Gröger Jul 09 '12 at 21:24
  • 1
    @JonasGröger Configurations are very powerful, but I found them tricky to figure out. If you're downloading from Maven repos the following will be useful http://stackoverflow.com/questions/7104364/how-are-maven-scopes-mapped-to-ivy-configurations-by-ivy/7116577#7116577 – Mark O'Connor Jul 09 '12 at 21:30
  • Thank you for providing me the link. Im relatively new to build management and really dont know much about it. Any more resources that are very helpful? – Jonas Gröger Jul 09 '12 at 23:06