Uploaded image for project: 'Maven Dependency Plugin'
  1. Maven Dependency Plugin
  2. MDEP-651

unpack-dependencies should warn when it overrides extracted files on macos (case insensitive FS)

    XMLWordPrintableJSON

    Details

    • Type: Wish
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.1.1
    • Fix Version/s: None
    • Component/s: unpack-dependencies
    • Labels:
      None

      Description

      Background :

      We are upgrading to a recent version of aspose-imaging and ran into an issue with our `unpack-dependencies` configuration when ran locally on macos

      This is affecting our dev loop mostly, you can reproduce it with 

      git clone https://github.com/viqueen/maven-playground
      cd maven-playground
      mvn test

      long story short :

      `maven-dependency-plugin` has the `unpack-dependencies` mojo that relies on plexus un-archiver which in a file system like mac (not case sensitive) , might end up overriding files , leading in some cases to a corrupted class path , aspose-imaging library is an example of that : it contains classes and interfaces named as follow : com.aspose.internal.imaging.gq/aq (interface) , com.aspose.internal.imaging.gq/aQ (class implementing the interface)  , notice the case sensitive naming

      so on mac , the plugin will override the aq interface with the content of aQ type , leading to a NoClassDefFoundError because the file name and its content do not match

      java.lang.NoClassDefFoundError: com/aspose/imaging/internal/gq/aq (wrong name: com/aspose/imaging/internal/gq/aQ)
      at java.lang.ClassLoader.defineClass1(Native Method)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
      at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
      at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
      

      Workaround :

      turns out our project config no longer requires unpacking dependencies so we disabled the thing

      Suggestion :

      not sure this is even fixable , but would be nice to have some debug / warning logs that it is happening so developers can diagnose errors more easily; basically throw in some love onto https://github.com/viqueen/plexus-archiver/blob/master/src/main/java/org/codehaus/plexus/archiver/AbstractUnArchiver.java#L346

      in our particular use case , we are consuming the plugin through https://bitbucket.org/atlassian/amps/src/903a1ce408da5b8500ed0d7e0e5701eb83d8cde4/amps-maven-plugin/src/main/java/com/atlassian/maven/plugins/amps/MavenGoals.java?at=8.0-stable&fileviewer=file-view-default#MavenGoals.java-458 , these internals are not exactly common knowledge and the logs were not helping either, devs knew it was FS related though just not clear on what triggers the problem

      so optionally failing the build if/when it happens could point our devs on the right track much faster

       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                viqueen Hasnae Rehioui
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 10m
                  10m