Ivy
  1. Ivy
  2. IVY-1441

Embedded Ivy fails to parse ivy-settings.xml file if it contains <pgp> element

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.0
    • Fix Version/s: 2.4.0-RC1
    • Component/s: None
    • Labels:
      None

      Description

      I've got a Eclipse java project where I have a ivy.xml and ivy-settings.xml added and I'm configuring a Ivy container that I'm pointing to the ivy-settings.xml file. The problem is that inside the ivy-settings.xml there is an element like this:

      <signers><pgp keyId="$

      {pgp.keyname}

      " name="$

      {pgp.generator}

      " password="$

      {pgp.passphrase}

      " /></signers>

      When the IvyDE plugin loads the embedded Ivy runtime from the OSGi bundle and have it parse the ivy-settings.xml file it will throw NoClassDefFound when it hits the <pgp> element. See attached log file for error.

      1. ivy-error.txt
        3 kB
        Gregory Amerson

        Activity

        Hide
        Gregory Amerson added a comment -

        I've debugged this and its because ivy-settings.xml parser is trying to create an instance of this class:
        org.apache.ivy.plugins.signer.bouncycastle.OpenPGPSignatureGenerator

        This class requires several classes in the org.bouncycastle.* package, however, the OSGi classloader from Eclipse that is creating the new instance of OpenPGPSignatureGenerator can't find the needed classes from org.bouncycastle on the bundle classpath.

        After trying several alternatives, it seems that the only way to get this to work is to modify the org.apache.ivy_xxx.jar OSGi bundle itself and add the necessary "Import-Package: org.bouncycastle.*" packages and also make them available to Eclipse OSGi runtime. How does IvyDE team feel about this?

        Show
        Gregory Amerson added a comment - I've debugged this and its because ivy-settings.xml parser is trying to create an instance of this class: org.apache.ivy.plugins.signer.bouncycastle.OpenPGPSignatureGenerator This class requires several classes in the org.bouncycastle.* package, however, the OSGi classloader from Eclipse that is creating the new instance of OpenPGPSignatureGenerator can't find the needed classes from org.bouncycastle on the bundle classpath. After trying several alternatives, it seems that the only way to get this to work is to modify the org.apache.ivy_xxx.jar OSGi bundle itself and add the necessary "Import-Package: org.bouncycastle.*" packages and also make them available to Eclipse OSGi runtime. How does IvyDE team feel about this?
        Hide
        Gregory Amerson added a comment -

        Here is my suggested fix for the Ivy osgi jar that would enable it to import bouncycastle packages if they were available.

        https://github.com/gamerson/ivy/commit/c5df268b070290938e660937ca261cf161bae67a

        Show
        Gregory Amerson added a comment - Here is my suggested fix for the Ivy osgi jar that would enable it to import bouncycastle packages if they were available. https://github.com/gamerson/ivy/commit/c5df268b070290938e660937ca261cf161bae67a
        Hide
        Nicolas Lalevée added a comment -

        I have grep all Ivy code to find every import. I have added every missing one to the MANIFEST, including the bouncycastle ones.

        Show
        Nicolas Lalevée added a comment - I have grep all Ivy code to find every import. I have added every missing one to the MANIFEST, including the bouncycastle ones.
        Hide
        Gregory Amerson added a comment -

        Thanks Nicolas for making those changes.

        Show
        Gregory Amerson added a comment - Thanks Nicolas for making those changes.

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development