Jared Hodge created MDEP-341:
--------------------------------

             Summary: maven-dependency-plugin unpack goal fails under Linux on 
files with parentheses and single quotes in the filename.
                 Key: MDEP-341
                 URL: https://jira.codehaus.org/browse/MDEP-341
             Project: Maven 2.x Dependency Plugin
          Issue Type: Bug
          Components: unpack
    Affects Versions: 2.4, 2.0
         Environment: Linux only (works on Windows)
            Reporter: Jared Hodge


The maven-dependency-plugin fails for files with parentheses in the filename 
under Linux.  Sample pom snippet:
{code}
<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>
{code}

Fails with the following error:
{code}
[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] ------------------------------------------------------------------------
{code}

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.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to