Ivy
  1. Ivy
  2. IVY-1364

buildlist task chokes on absolute path to parent Ivy module

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.0, 2.3.0-RC1
    • Fix Version/s: 2.3.0-RC2, 2.4.0-RC1
    • Component/s: Ant, Core
    • Labels:
    • Environment:

      Ant 1.7.1 (should be reproducible on Ant 1.8.3)

      Description

      The ivy:buildlist Ant task is erroring when it encounters an absolute path to a parent Ivy module specified in the /ivy-module/info/extends element's location attribute. This problem is not unique to Ivy 2.3.0-rc1; I've seen it in Ivy 2.2.0.

      I can verify that the parent ivy.xml file is there at the specified path. If I specify a relative path to the parent ivy.xml, buildlist works.

      In my test case, which I explain shortly, an absolute path for the extends attribute produces this error:
      ...\testAbsolutePathToParent\multimodule-build\build.xml:28: impossible to parse ivy file for ...\testAbsolutePathToParent\croatia\build.xml: ivyfile=...\testAbsolutePathToParent\croatia\ivy.xml exception=java.text.ParseException: Problem occurred while parsing ivy file: null in file:/.../testAbsolutePathToParent/croatia/ivy.xml
      at org.apache.ivy.ant.IvyBuildList.doExecute(IvyBuildList.java:215)
      at org.apache.ivy.ant.IvyTask.execute(IvyTask.java:277)
      ...
      Caused by: java.text.ParseException: Problem occurred while parsing ivy file: null in file:/.../testAbsolutePathToParent/croatia/ivy.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.ivy.ant.IvyBuildList.doExecute(IvyBuildList.java:207)
      ... 35 more
      Caused by: org.xml.sax.SAXException: Problem occurred while parsing ivy file: null
      ...
      — Nested Exception —
      java.text.ParseException: Problem occurred while parsing ivy file: null in file:/.../testAbsolutePathToParent/croatia/ivy.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)
      ...
      Caused by: org.xml.sax.SAXException: Problem occurred while parsing ivy file: null
      java.lang.NullPointerException
      at org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser$Parser.startElement(XmlModuleDescriptorParser.java:386)
      at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:506)
      ...
      Caused by: java.lang.NullPointerException
      at org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser$Parser.parseOtherIvyFile(XmlModuleDescriptorParser.java:659)
      at org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser$Parser.extendsStarted(XmlModuleDescriptorParser.java:443)
      at org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser$Parser.startElement(XmlModuleDescriptorParser.java:327)
      ... 57 more

      This is what occurs when the haltOnError attribute is set to "true" on ivy:buildlist. If I set haltOnError="false" in my test case, the exception goes away, but I see the following build order:
      1. croatia
      2. germany
      3. ireland
      4. bootstrap-parent
      5. master-parent

      What's wrong about this build order is that germany depends on ireland and croatia depends on master-parent, in addition to extending it, and yet germany comes before ireland and croatia comes before master-parent.

      The roughly correct build order, as exhibited with a relative path to the parent, is:
      1. bootstrap-parent
      2. master-parent
      3. croatia
      4. ireland
      5. germany

      So, in addition to being incorrect, this behavior is just plain inconsistent.

      TEST CASE INSTRUCTIONS:
      I've attached a ZIP containing two standalone test cases, each consisting of a suite of Ant projects that together comprise a multimodule build whose build order is to be determined by the ivy:buildlist task:

      • testAbsolutePathToParent: The extends@location attribute uses an absolute path.
      • testRelativePathToParent: The extends@location attribute uses an absolute path.

      When running Ant from one of these test cases, you need to specify the location of the Ivy 2.3.0-rc1 installation using one of the following:

      • an IVY_DIR environment variable
      • an env.IVY_DIR user property, i.e. -Denv.IVY_DIR=...
      • an ivy.dir user property, i.e. -Divy.dir=...

      When running Ant for testAbsolutePathToParent, you need to specify the absolute path to the BuildlistAndExtendsIntegrationTest/testAbsolutePathToParent/master-parent directory using either of the following:

      • a MASTER_PARENT_DIR environment variable
      • an env.MASTER_PARENT_DIR user property, i.e. -Denv.MASTER_PARENT_DIR=...

      To run the build in either of these suites, go to the multimodule-build directory, and execute "ant" or "ant init"—while specifying the Ivy installation directory and the master-parent directory. You can also run "ant cleancache" to clear out the Ivy cache. However, you shouldn't need to do this regularly because each of these test cases uses its own dedicated Ivy cache.

      NOTE: This issue is broached in the email thread "buildlist task chokes on absolute path to parent Ivy module" on the ivy-user mailing list.

      1. BuildlistAndExtendsIntegrationTest.zip
        17 kB
        Mitch Gitman
      2. IVY-1364-2.3.x.patch
        1 kB
        Mitch Gitman
      3. IVY-1364-trunk.patch
        1 kB
        Mitch Gitman
      4. ivy-2.3.x.patch
        10 kB
        Mitch Gitman
      5. ivy-trunk.patch
        10 kB
        Mitch Gitman

        Activity

        Mitch Gitman created issue -
        Mitch Gitman made changes -
        Field Original Value New Value
        Attachment BuildlistAndExtendsIntegrationTest.zip [ 12533772 ]
        Nicolas Lalevée made changes -
        Labels testcase
        Hide
        Mitch Gitman added a comment -

        I managed to come up with a simple, isolated fix to this bug. I just had to make the existing XmlModuleDescriptorParser.checkParentModuleOnFilesystem method account for an absolute path as well as a relative path. Upon doing a release build of Ivy, all existing tests passed. I've attached two patch files: one for the 2.3.x branch of Ivy core, the other for trunk.

        Show
        Mitch Gitman added a comment - I managed to come up with a simple, isolated fix to this bug. I just had to make the existing XmlModuleDescriptorParser.checkParentModuleOnFilesystem method account for an absolute path as well as a relative path. Upon doing a release build of Ivy, all existing tests passed. I've attached two patch files: one for the 2.3.x branch of Ivy core, the other for trunk.
        Mitch Gitman made changes -
        Attachment IVY-1364-2.3.x.patch [ 12535949 ]
        Attachment IVY-1364-trunk.patch [ 12535950 ]
        Nicolas Lalevée made changes -
        Labels testcase patch testcase
        Hide
        Mitch Gitman added a comment -

        I'm attaching two patch files, one for the 2.3.x branch, one for trunk. These patches contain the fixes for three bugs: IVY-1359, IVY-1363, IVY-1364. The fixes involve a single file: XmlModuleDescriptorParser.

        These patch files supersede the patch files I'd previously attached to this issue.

        Show
        Mitch Gitman added a comment - I'm attaching two patch files, one for the 2.3.x branch, one for trunk. These patches contain the fixes for three bugs: IVY-1359 , IVY-1363 , IVY-1364 . The fixes involve a single file: XmlModuleDescriptorParser. These patch files supersede the patch files I'd previously attached to this issue.
        Mitch Gitman made changes -
        Attachment ivy-2.3.x.patch [ 12536920 ]
        Attachment ivy-trunk.patch [ 12536921 ]
        Hide
        Nicolas Lalevée added a comment -

        I have integrated your patch, modified regarding Jean-Louis comments.
        Before letting this into the 2.3.x branch, it would be nice if you can confirm it solves your issues. I didn't took the time to test it under Windows.

        Show
        Nicolas Lalevée added a comment - I have integrated your patch, modified regarding Jean-Louis comments. Before letting this into the 2.3.x branch, it would be nice if you can confirm it solves your issues. I didn't took the time to test it under Windows.
        Nicolas Lalevée made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Nicolas Lalevée [ hibou ]
        Fix Version/s trunk [ 12320744 ]
        Resolution Fixed [ 1 ]
        Nicolas Lalevée made changes -
        Fix Version/s 2.3.0 [ 12320743 ]
        Maarten Coene made changes -
        Fix Version/s 2.4.0-RC1 [ 12326648 ]
        Fix Version/s trunk [ 12320744 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        24d 16h 2m 1 Nicolas Lalevée 22/Jul/12 20:47

          People

          • Assignee:
            Nicolas Lalevée
            Reporter:
            Mitch Gitman
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development