- Fix Scp deployer when it use compress mode.

- Add documentation for the compress mode property.


git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@115238 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
evenisse 2004-05-12 12:33:55 +00:00
parent 3fcf502764
commit 42e432b0e2
6 changed files with 55 additions and 9 deletions

View File

@ -27,7 +27,7 @@ import org.apache.maven.project.Project;
* Perform mapping between project's properties and attributes of DeployRequest class. * Perform mapping between project's properties and attributes of DeployRequest class.
* *
* @author <a href="mailto:michal.maczka@dimatics.com">Michal Maczka</a> * @author <a href="mailto:michal.maczka@dimatics.com">Michal Maczka</a>
* @version $Id: RepositoryInfoBuilder.java,v 1.3 2004/05/02 15:04:34 vmassol Exp $ * @version $Id: RepositoryInfoBuilder.java,v 1.4 2004/05/12 12:33:55 evenisse Exp $
*/ */
public class RepositoryInfoBuilder public class RepositoryInfoBuilder
{ {
@ -67,6 +67,10 @@ public class RepositoryInfoBuilder
(String) project.getContext().getVariable( (String) project.getContext().getVariable(
"maven.repo." + repository + ".privatekey"); "maven.repo." + repository + ".privatekey");
String compress =
(String) project.getContext().getVariable(
"maven.repo." + repository + ".compress");
String dir = String dir =
(String) project.getContext().getVariable( (String) project.getContext().getVariable(
"maven.repo." + repository + ".directory"); "maven.repo." + repository + ".directory");
@ -95,6 +99,18 @@ public class RepositoryInfoBuilder
repoInfo.setProxyHost(proxyHost); repoInfo.setProxyHost(proxyHost);
repoInfo.setProxyUserName(proxyUser); repoInfo.setProxyUserName(proxyUser);
repoInfo.setProxyPassword(proxyPassword); repoInfo.setProxyPassword(proxyPassword);
if (compress != null)
{
try
{
repoInfo.setCompress(new Boolean(compress).booleanValue());
}
catch (Exception e)
{
throw new MalformedURLException(
"maven.repo." + repository + ".compress should be a boolean");
}
}
if (port != null) if (port != null)
{ {
try try

View File

@ -23,7 +23,7 @@ package org.apache.maven.deploy;
* perform a deployment. * perform a deployment.
* *
* @author <a href="mailto:michal.maczka@dimatics.com">Michal Maczka</a> * @author <a href="mailto:michal.maczka@dimatics.com">Michal Maczka</a>
* @version $Id: RepositoryInfo.java,v 1.3 2004/05/02 15:04:34 vmassol Exp $ * @version $Id: RepositoryInfo.java,v 1.4 2004/05/12 12:33:55 evenisse Exp $
*/ */
public class RepositoryInfo public class RepositoryInfo
{ {
@ -73,6 +73,25 @@ public class RepositoryInfo
/** basedir */ /** basedir */
private String basedir; private String basedir;
/** compress */
private boolean compress;
/**
* @param compress
*/
public void setCompress(boolean compress)
{
this.compress = compress;
}
/**
* @return
*/
public boolean getCompress()
{
return compress;
}
/** /**
* @return * @return
*/ */

View File

@ -39,7 +39,7 @@ import java.util.List;
* An SSH2/SCP deployer * An SSH2/SCP deployer
* *
* @author Michal Maczka * @author Michal Maczka
* @version $Revision: 1.8 $ $Date: 2004/03/02 14:59:31 $ * @version $Revision: 1.9 $ $Date: 2004/05/12 12:33:55 $
*/ */
public class ScpDeployer extends GenericSshDeployer public class ScpDeployer extends GenericSshDeployer
{ {
@ -48,7 +48,6 @@ public class ScpDeployer extends GenericSshDeployer
/** SSH2 Channel name used to communicate with the server*/ /** SSH2 Channel name used to communicate with the server*/
public final static String EXEC_CHANNEL = "exec"; public final static String EXEC_CHANNEL = "exec";
public final static String COMPRESS = "maven.deployer.scp.compress";
/** /**
* I want to have compression by default * I want to have compression by default
@ -95,7 +94,7 @@ public class ScpDeployer extends GenericSshDeployer
*/ */
public void init(RepositoryInfo repoInfo) throws AuthenticationException public void init(RepositoryInfo repoInfo) throws AuthenticationException
{ {
setDeployNotCompressed(Boolean.getBoolean(COMPRESS)); setDeployNotCompressed(!repoInfo.getCompress());
super.init(repoInfo); super.init(repoInfo);
} }
@ -104,6 +103,7 @@ public class ScpDeployer extends GenericSshDeployer
*/ */
public void deploy(DeployRequest request) throws TransferFailedException public void deploy(DeployRequest request) throws TransferFailedException
{ {
System.out.println("deployNotCompressed=" + deployNotCompressed);
if (deployNotCompressed) if (deployNotCompressed)
{ {
doDeployNotCompressed(request); doDeployNotCompressed(request);
@ -112,6 +112,7 @@ public class ScpDeployer extends GenericSshDeployer
{ {
srcFiles.add(request.getSrcFile()); srcFiles.add(request.getSrcFile());
destFiles.add(request.getDestFile()); destFiles.add(request.getDestFile());
doDeployCompressed();
} }
} }
@ -190,12 +191,12 @@ public class ScpDeployer extends GenericSshDeployer
doCopy(session, request); doCopy(session, request);
String unzipCmd = String unzipCmd =
"unzip -d -u " "unzip -u "
+ getRepositoryInfo().getBasedir()
+ " "
+ getRepositoryInfo().getBasedir() + getRepositoryInfo().getBasedir()
+ "/" + "/"
+ request.getDestFile() + request.getDestFile()
+ " -d "
+ getRepositoryInfo().getBasedir()
+ "\n"; + "\n";
executeSimpleCommand(session, unzipCmd); executeSimpleCommand(session, unzipCmd);

View File

@ -26,6 +26,8 @@
</properties> </properties>
<body> <body>
<release version="1.2-SNAPSHOT" date="in CVS"> <release version="1.2-SNAPSHOT" date="in CVS">
<action dev="evenisse" type="add">Add documentation for the compress mode property.</action>
<action dev="evenisse" type="fix">Fix Scp deployer when it use compress mode.</action>
<action dev="brett" type="fix" issue="MPUBERJAR-5">Add uberjar extension mapping.</action> <action dev="brett" type="fix" issue="MPUBERJAR-5">Add uberjar extension mapping.</action>
</release> </release>
<release version="1.1" date="2004-03-10"> <release version="1.1" date="2004-03-10">

View File

@ -55,6 +55,7 @@ maven.repo.R3.username=michal
maven.repo.R3.directory=repo maven.repo.R3.directory=repo
maven.repo.R3.group=remote_group maven.repo.R3.group=remote_group
maven.repo.R3.privatekey=/home/michal/.ssh/id_dsa maven.repo.R3.privatekey=/home/michal/.ssh/id_dsa
maven.repo.R3.compress=true
#settings for repository 'R4' #settings for repository 'R4'
maven.repo.R4=file://c:\\temp maven.repo.R4=file://c:\\temp

View File

@ -121,6 +121,13 @@
</td> </td>
<td>Yes</td> <td>Yes</td>
</tr> </tr>
<tr>
<td>maven.repo.x.compress</td>
<td>
Used by scp if you want to compress the stream.
</td>
<td>Yes</td>
</tr>
</table> </table>
</section> </section>
<section name="Other properties used"> <section name="Other properties used">