Ivy
  1. Ivy
  2. IVY-1431

Also copy original metadata artifact (e.g. POM) on ivy:install

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.4.0-RC1
    • Component/s: None
    • Labels:

      Description

      Suppose you provide some module, which you are developing with Ivy and that has external dependencies (or even worse: non publically available dependencies). Then you might want to publish the module plus all dependencies to a filesystem repository, which then can be redistributed and which is usable for offline builds.

      So far, no problem. But if you do not want to or even can't force your consumers to use Ivy, then while you can create this "offline repository" in Maven layout, it still is not usable with Maven because the POMs of all your dependencies are missing. While Ivy remembers them (*.orig Files), they are not used.

      The attached patch will copy the cached original metadata in the install operation if it's type ends in ".original". Also, the restoring of the OriginArtifact from the Cache is modified to actually restore the OriginArtifact's orignal Artifact correctly.

      1. ivy-install-pom.patch
        12 kB
        Erwin Tratar
      2. ivy-1431.patch
        20 kB
        Erwin Tratar

        Activity

        Hide
        Nicolas Lalevée added a comment -

        Some comments on the patch:

        • in DefaultRepositoryCacheManager, rather than trying to guess what the origin is and so some sort of reverse engineering, what do you think about adding a new metadata, like artifact:ivy#ivy#xml#-761783604.orginl=artifact:commons-lang#pom.original#pom#-820436446
        • in InstallEngine, why is there so much tests to check if there is an origin ? The 3 firsts tests seems decent, the 4th one seems to be about being safer than sorry, but the 2 last ones about the type seems weird to me. Could you elaborate on why they are needed ?
        Show
        Nicolas Lalevée added a comment - Some comments on the patch: in DefaultRepositoryCacheManager, rather than trying to guess what the origin is and so some sort of reverse engineering, what do you think about adding a new metadata, like artifact:ivy#ivy#xml#-761783604.orginl=artifact:commons-lang#pom.original#pom#-820436446 in InstallEngine, why is there so much tests to check if there is an origin ? The 3 firsts tests seems decent, the 4th one seems to be about being safer than sorry, but the 2 last ones about the type seems weird to me. Could you elaborate on why they are needed ?
        Hide
        Nicolas Lalevée added a comment -

        And as discussed on the mailing list, an option "installOriginalMetadata" would make things safer, further more regarding backward compatibility.

        Show
        Nicolas Lalevée added a comment - And as discussed on the mailing list, an option "installOriginalMetadata" would make things safer, further more regarding backward compatibility.
        Hide
        Erwin Tratar added a comment -

        New metadata is nice, but only relying on the metadata would require everyone to throw away their caches. So maybe add the metadata and use it, but if it's not available perform the "reverse engineeing", as it could be cached with a previous version.

        The last 2 checks are there to only install the original metadata if the type (e.g. "pom.original") is different from the actual metadata (i.e. "ivy" + ".original"). So if the dependency is not from a m2 repo, then no original metadata is installed.

        I will update the patch with additional metadata (with fallback) and "installOriginalMetadata".

        Show
        Erwin Tratar added a comment - New metadata is nice, but only relying on the metadata would require everyone to throw away their caches. So maybe add the metadata and use it, but if it's not available perform the "reverse engineeing", as it could be cached with a previous version. The last 2 checks are there to only install the original metadata if the type (e.g. "pom.original") is different from the actual metadata (i.e. "ivy" + ".original"). So if the dependency is not from a m2 repo, then no original metadata is installed. I will update the patch with additional metadata (with fallback) and "installOriginalMetadata".
        Hide
        Carsten Pfeiffer added a comment -

        Any comment on the updated patch? It now provides the option "installOriginalMetadata" and hence is completely backwards compatible.

        Show
        Carsten Pfeiffer added a comment - Any comment on the updated patch? It now provides the option "installOriginalMetadata" and hence is completely backwards compatible.
        Hide
        Nicolas Lalevée added a comment -

        The patch looks really great. I see the doc has been updated which is really nice.
        I would just need some little time to test it a little bit.

        There maybe just a little hitch. In the test file test/repositories/ivysettings.xml I see an url concatenation: file:$

        {ivy.settings.dir}

        /m2. From experience, this doesn't work on Windows, and there is no proper way make an url concatenation work on every platform. But I could be wrong. And it's not a blocker for me for the patch to be integrated.

        Show
        Nicolas Lalevée added a comment - The patch looks really great. I see the doc has been updated which is really nice. I would just need some little time to test it a little bit. There maybe just a little hitch. In the test file test/repositories/ivysettings.xml I see an url concatenation: file:$ {ivy.settings.dir} /m2. From experience, this doesn't work on Windows, and there is no proper way make an url concatenation work on every platform. But I could be wrong. And it's not a blocker for me for the patch to be integrated.
        Hide
        Erwin Tratar added a comment -

        The testcases run fine on Windows. I tested it with Java7, so maybe there was a problem with previous versions.

        Show
        Erwin Tratar added a comment - The testcases run fine on Windows. I tested it with Java7, so maybe there was a problem with previous versions.
        Hide
        Nicolas Lalevée added a comment -

        patch applied, works like a charm.
        Thanks !

        Show
        Nicolas Lalevée added a comment - patch applied, works like a charm. Thanks !

          People

          • Assignee:
            Nicolas Lalevée
            Reporter:
            Erwin Tratar
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development