Optimized wagon plugin is trying to unzip the wrong file
--------------------------------------------------------

                 Key: MOJO-1536
                 URL: http://jira.codehaus.org/browse/MOJO-1536
             Project: Mojo
          Issue Type: Bug
          Components: wagon
            Reporter: Denis Cabasson
            Priority: Critical


I am trying to use the optimized version of the wagon plugin to upload a bunch 
of files (using sshext).

The wagon plugin is copying the zip allright :
{quote}
Executing command: cmd.exe /X /C "pscp -i "****.ppk" -batch wagon18317.zip 
*...@***:///thefolder/wagon18317.zip"
{quote}

but when trying to unzip :
{quote}
Executing command: cmd.exe /X /C "plink -i "****.ppk" -batch *...@**** "unzip 
-o -qq -d / //wagon18317.zip""
{quote}

The name of the remote folder has been lost....

I tracked that in the code to :
https://svn.codehaus.org/mojo/trunk/mojo/wagon-maven-plugin/src/main/java/org/codehaus/mojo/wagon/shared/DefaultWagonUpload.java
{code:java}
        logger.info( "Uploading " + fileset );

        File zipFile;
        zipFile = File.createTempFile( "wagon", ".zip" );

        try
        {
            FileSetManager fileSetManager = new FileSetManager( logger, 
logger.isDebugEnabled() );
            String[] files = fileSetManager.getIncludedFiles( fileset );
            
            if ( files.length == 0 )
            {
                logger.info( "Nothing to upload.");
                return;
            }
            
            logger.info( "Creating " + zipFile + " ..." );
            createZip( files, zipFile, fileset.getDirectory() );

            String remoteFileName = zipFile.getName();
            
            String remoteFile = zipFile.getName();
            String remoteDir = fileset.getOutputDirectory();
            if ( !StringUtils.isBlank( remoteDir ) )
            {
                remoteFile = remoteDir + "/" + remoteFile;
            }            

            logger.info( "Uploading " + zipFile + " to " + 
wagon.getRepository().getUrl() + "/" + remoteFile + " ..." );
            wagon.put( zipFile, remoteFile );
            
            String targetRepoBaseDirectory = 
wagon.getRepository().getBasedir();  
            
            // We use the super quiet option here as all the noise seems to 
kill/stall the connection
            String command = "unzip -o -qq -d " + targetRepoBaseDirectory + " " 
+ targetRepoBaseDirectory + "/" + remoteFileName;

            try
            {
                logger.info( "Remote: " + command );
                ( (CommandExecutor) wagon ).executeCommand( command );
            }
            finally
            {
                command = "rm -f " + targetRepoBaseDirectory + "/" + 
remoteFileName ;
                logger.info( "Remote: " + command );
{code}

Why use *wagon.getRepository().getUrl()* to get the remote directory to upload 
to, and *wagon.getRepository().getBasedir()* to unzip the zip file? Shouldn't 
it be the one and same folder at both places?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to