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

maven-dependency-plugin unpack goal fails under Linux on files with parentheses and single quotes in the filename.

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.0, 2.4
    • Fix Version/s: None
    • Component/s: unpack
    • Labels:
      None
    • Environment:
      Linux only (works on Windows)
    • Number of attachments :
      0

      Description

      The maven-dependency-plugin fails for files with parentheses in the filename under Linux. Sample pom snippet:

      <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>2.4</version>
          <executions>
              <execution>
                  <id>unpackFullInstall</id>
                  <phase>generate-resources</phase>
                  <goals>
                      <goal>unpack</goal>
                  </goals>
                  <configuration>
                      <artifactItems>
                          <artifactItem>
                              <groupId>com.example</groupId>
                              <artifactId>myArtifact</artifactId>
                              <version>1.0</version>
                              <type>tar.gz</type>
                              <classifier>linux64</classifier>
                              <outputDirectory>target</outputDirectory>
                          </artifactItem>
                      </artifactItems>
                      <overWriteIfNewer>false</overWriteIfNewer>
                  </configuration>
              </execution>
          </executions>
      </plugin>
      

      Fails with the following error:

      [INFO] Expanding: /home/jared/.m2/repository/com/example/myArtifact-1.0-linux64.tar.gz into /home/jared/buildDir/target
      [WARNING] -------------------------------
      [WARNING] Standard error:
      [WARNING] -------------------------------
      [WARNING] 
      [WARNING] -------------------------------
      [WARNING] Standard output:
      [WARNING] -------------------------------
      [WARNING] /bin/sh: -c: line 0: syntax error near unexpected token `('
      /bin/sh: -c: line 0: `cd /home/jared/buildDir/target/unzipDir/ && chmod 644 '/home/jared/buildDir/target/unzipDir/jared's (fun) file.xml''
      
      [WARNING] -------------------------------
      org.codehaus.plexus.archiver.ArchiverException: chmod exit code was: 1
      	at org.codehaus.plexus.archiver.util.ArchiveEntryUtils.chmod(ArchiveEntryUtils.java:107)
      	at org.codehaus.plexus.archiver.zip.AbstractZipUnArchiver.extractFile(AbstractZipUnArchiver.java:234)
      	at org.codehaus.plexus.archiver.tar.TarUnArchiver.execute(TarUnArchiver.java:93)
      	at org.codehaus.plexus.archiver.AbstractUnArchiver.extract(AbstractUnArchiver.java:119)
      	at org.apache.maven.plugin.dependency.AbstractDependencyMojo.unpack(AbstractDependencyMojo.java:258)
      	at org.apache.maven.plugin.dependency.fromConfiguration.UnpackMojo.unpackArtifact(UnpackMojo.java:116)
      	at org.apache.maven.plugin.dependency.fromConfiguration.UnpackMojo.execute(UnpackMojo.java:94)
      	at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:483)
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:678)
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:540)
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:519)
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:371)
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:332)
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:181)
      	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:356)
      	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:137)
      	at org.apache.maven.cli.MavenCli.main(MavenCli.java:356)
      	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)
      [INFO] ------------------------------------------------------------------------
      [ERROR] BUILD ERROR
      [INFO] ------------------------------------------------------------------------
      [INFO] Error unpacking file: /home/jared/.m2/repository/com/example/myArtifact-1.0-linux64.tar.gz to: /home/jared/buildDir/target
      org.codehaus.plexus.archiver.ArchiverException: chmod exit code was: 1
      
      [INFO] ------------------------------------------------------------------------
      [INFO] For more information, run Maven with the -e switch
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 1 minute 44 seconds
      [INFO] Finished at: Fri Jan 20 13:16:22 CST 2012
      [INFO] Final Memory: 47M/402M
      [INFO] ------------------------------------------------------------------------
      

      Sorry if my anonymization of the error makes this painful to test.
      I think it's the parenthesis that causing the problem (from the error). It's probably not being properly escaped for BASH.

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Unassigned
            Reporter:
            Jared Hodge
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated: