- 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.
*
* @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
{
@ -67,6 +67,10 @@ public class RepositoryInfoBuilder
(String) project.getContext().getVariable(
"maven.repo." + repository + ".privatekey");
String compress =
(String) project.getContext().getVariable(
"maven.repo." + repository + ".compress");
String dir =
(String) project.getContext().getVariable(
"maven.repo." + repository + ".directory");
@ -95,6 +99,18 @@ public class RepositoryInfoBuilder
repoInfo.setProxyHost(proxyHost);
repoInfo.setProxyUserName(proxyUser);
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)
{
try

View File

@ -23,7 +23,7 @@ package org.apache.maven.deploy;
* perform a deployment.
*
* @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
{
@ -73,6 +73,25 @@ public class RepositoryInfo
/** 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
*/

View File

@ -39,7 +39,7 @@ import java.util.List;
* An SSH2/SCP deployer
*
* @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
{
@ -48,7 +48,6 @@ public class ScpDeployer extends GenericSshDeployer
/** SSH2 Channel name used to communicate with the server*/
public final static String EXEC_CHANNEL = "exec";
public final static String COMPRESS = "maven.deployer.scp.compress";
/**
* I want to have compression by default
@ -95,7 +94,7 @@ public class ScpDeployer extends GenericSshDeployer
*/
public void init(RepositoryInfo repoInfo) throws AuthenticationException
{
setDeployNotCompressed(Boolean.getBoolean(COMPRESS));
setDeployNotCompressed(!repoInfo.getCompress());
super.init(repoInfo);
}
@ -104,6 +103,7 @@ public class ScpDeployer extends GenericSshDeployer
*/
public void deploy(DeployRequest request) throws TransferFailedException
{
System.out.println("deployNotCompressed=" + deployNotCompressed);
if (deployNotCompressed)
{
doDeployNotCompressed(request);
@ -112,6 +112,7 @@ public class ScpDeployer extends GenericSshDeployer
{
srcFiles.add(request.getSrcFile());
destFiles.add(request.getDestFile());
doDeployCompressed();
}
}
@ -190,12 +191,12 @@ public class ScpDeployer extends GenericSshDeployer
doCopy(session, request);
String unzipCmd =
"unzip -d -u "
+ getRepositoryInfo().getBasedir()
+ " "
"unzip -u "
+ getRepositoryInfo().getBasedir()
+ "/"
+ request.getDestFile()
+ " -d "
+ getRepositoryInfo().getBasedir()
+ "\n";
executeSimpleCommand(session, unzipCmd);
@ -212,7 +213,7 @@ public class ScpDeployer extends GenericSshDeployer
if (getRepositoryInfo().getGroup() != null)
{
String chgrpCmd =
"chgrp -r"
"chgrp -r "
+ getRepositoryInfo().getGroup()
+ " "
+ getRepositoryInfo().getBasedir()

View File

@ -26,6 +26,8 @@
</properties>
<body>
<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>
</release>
<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.group=remote_group
maven.repo.R3.privatekey=/home/michal/.ssh/id_dsa
maven.repo.R3.compress=true
#settings for repository 'R4'
maven.repo.R4=file://c:\\temp

View File

@ -121,6 +121,13 @@
</td>
<td>Yes</td>
</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>
</section>
<section name="Other properties used">