Maven Dependency Plugin
  1. Maven Dependency Plugin
  2. MDEP-194

ArchiverException when using maven dependency plugin in multi-module projects

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: 2.0
    • Fix Version/s: None
    • Component/s: unpack, unpack-dependencies
    • Labels:
      None
    • Number of attachments :
      5

      Description

      Having the following module hierarchy the unpack-dependencies goal of the maven-dependency-plugin produces an ArchiverException.

      • A
        • B
        • C (depends on B)

      I took a quick look into the code and found that when unpacking the dependencies of module C the method unpack(File, File, String, String) of class org.apache.maven.plugin.dependency.AbstractDependencyMojo gets passed the target/classes directory of B as source file (instead of the created jar).

      part of the pom.xml which caused the error:

      <profile>
        <id>multi-module-coverage</id>
        <build>
          <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-dependency-plugin</artifactId>
              <executions>
                <execution>
                  <id>unpack-dependencies</id>
                  <phase>process-classes</phase>
                  <goals>
                    <goal>unpack-dependencies</goal>
                  </goals>
                  <configuration>
                    <outputDirectory>${project.build.directory}/classes</outputDirectory>
                    <excludeClassifiers>tests</excludeClassifiers>
                  </configuration>
                </execution>
              </executions>
            </plugin>
          </plugins>
        </build>
      </profile>
      

      exception:

      org.codehaus.plexus.archiver.ArchiverException: The source must not be a directory.
              at org.codehaus.plexus.archiver.AbstractUnArchiver.validate(AbstractUnArchiver.java:174)
              at org.codehaus.plexus.archiver.AbstractUnArchiver.extract(AbstractUnArchiver.java:107)
              at org.apache.maven.plugin.dependency.AbstractDependencyMojo.unpack(AbstractDependencyMojo.java:266)
              at org.apache.maven.plugin.dependency.UnpackDependenciesMojo.execute(UnpackDependenciesMojo.java:90)
              at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:447)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:480)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:459)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
              at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:333)
              at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:126)
              at org.apache.maven.cli.MavenCli.main(MavenCli.java:282)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
              at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
              at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
              at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
      
      1. maven-dependency-plugin-2.5-SNAPSHOT-copy-artifact.patch
        4 kB
        Michael Berg
      2. maven-dependency-plugin-2.5-SNAPSHOT-copy-artifact2.patch
        5 kB
        Torsten Krah
      3. mdep-194-its-aoc.diff
        14 kB
        Art O Cathain
      4. mdp-194-src-main-aoc.diff
        3 kB
        Art O Cathain
      5. plexus-archiver-1.0-alpha-9-DirectoryUnArchiver.diff
        7 kB
        Reimer Prochnow

        Issue Links

          Activity

          Hide
          Gili added a comment -

          Four years and counting. If you're not going to fix it anytime soon, please provide a workaround! What are we supposed to do?

          Show
          Gili added a comment - Four years and counting. If you're not going to fix it anytime soon, please provide a workaround! What are we supposed to do?
          Hide
          Gili added a comment -

          Grr. Note to self, this error also occurs if you attempt to unpack a dependency that requires a classifier but you omit it. Meaning, if you have:

          • A
            • B (classifier = foo)
            • C (attempts to unpack B but without a classifier)

          then C will throw an exception. If you add the classifier, however, it works.

          Show
          Gili added a comment - Grr. Note to self, this error also occurs if you attempt to unpack a dependency that requires a classifier but you omit it. Meaning, if you have: A B (classifier = foo) C (attempts to unpack B but without a classifier) then C will throw an exception. If you add the classifier, however, it works.
          Hide
          Art O Cathain added a comment - - edited

          I have a new patch, based on Nicolas Cornaglia's patch C attached to MDEP-187.

          Show
          Art O Cathain added a comment - - edited I have a new patch, based on Nicolas Cornaglia's patch C attached to MDEP-187 .
          Hide
          Art O Cathain added a comment -

          I have also created some integration tests

          Show
          Art O Cathain added a comment - I have also created some integration tests
          Hide
          Herve Boutemy added a comment -

          duplicate of MDEP-98: closing this duplicate will help focus everybody's energy

          Show
          Herve Boutemy added a comment - duplicate of MDEP-98 : closing this duplicate will help focus everybody's energy

            People

            • Assignee:
              Unassigned
              Reporter:
              Sascha Hofer
            • Votes:
              45 Vote for this issue
              Watchers:
              40 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: