implement scpexe args

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@179362 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
brett
2005-06-01 05:46:59 +00:00
parent 1c878d222a
commit 8897da56e0
2 changed files with 81 additions and 48 deletions

View File

@@ -180,7 +180,7 @@ public class DefaultArtifactDeployer
{
Repository repository = new Repository( "local", "file:" + project.getContext().getMavenRepoLocal() );
String repositoryPath = handler.constructRepositoryFullPath( type, project, version );
deployFile( repository, file, repositoryPath );
deployFile( repository, file, repositoryPath, project );
}
catch ( Exception e )
{
@@ -310,7 +310,7 @@ public class DefaultArtifactDeployer
AuthenticationInfo authenticationInfo = RepositoryBuilder.getAuthenticationInfo( project, repo );
try
{
deployFiles( repository, srcFiles, destFiles, authenticationInfo );
deployFiles( repository, srcFiles, destFiles, authenticationInfo, project );
success = true;
}
catch ( Exception e )
@@ -328,15 +328,15 @@ public class DefaultArtifactDeployer
}
}
private void deployFile( Repository repository, File src, String dest )
private void deployFile( Repository repository, File src, String dest, Project project )
throws ResourceDoesNotExistException, MalformedURLException, NoSuchAlgorithmException, TransferFailedException,
ConnectionException, AuthenticationException, AuthorizationException
{
deployFiles( repository, Collections.singletonList( src ), Collections.singletonList( dest ), null );
deployFiles( repository, Collections.singletonList( src ), Collections.singletonList( dest ), null, project );
}
private void deployFiles( Repository repository, List srcFiles, List destFiles,
AuthenticationInfo authenticationInfo )
AuthenticationInfo authenticationInfo, Project project )
throws ConnectionException, AuthenticationException, ResourceDoesNotExistException, TransferFailedException,
AuthorizationException, MalformedURLException, NoSuchAlgorithmException
{
@@ -347,7 +347,7 @@ public class DefaultArtifactDeployer
throw new IllegalArgumentException( msg );
}
Wagon wagon = getWagon( repository.getProtocol() );
Wagon wagon = getWagon( repository.getProtocol(), project, repository.getId() );
wagon.addTransferListener( new UploadMeter() );
wagon.addTransferListener( new ChecksumObserver() );
wagon.addTransferListener( new ChecksumObserver( "SHA-1" ) );
@@ -377,7 +377,7 @@ public class DefaultArtifactDeployer
}
}
private Wagon getWagon( String protocol )
private Wagon getWagon( String protocol, Project project, String id )
throws MalformedURLException
{
if ( protocol.equals( "http" ) )
@@ -386,7 +386,9 @@ public class DefaultArtifactDeployer
}
else if ( protocol.equals( "ftp" ) )
{
return new FtpWagon();
FtpWagon ftpWagon = new FtpWagon();
RepositoryBuilder.configureFtpWagon( project, id, ftpWagon );
return ftpWagon;
}
else if ( protocol.equals( "sftp" ) )
{
@@ -402,7 +404,9 @@ public class DefaultArtifactDeployer
}
else if ( protocol.equals( "scpexe" ) )
{
return new ScpExternalWagon();
ScpExternalWagon scpExternalWagon = new ScpExternalWagon();
RepositoryBuilder.configureSshExternalWagon( project, id, scpExternalWagon );
return scpExternalWagon;
}
else
{

View File

@@ -17,15 +17,16 @@ package org.apache.maven.artifact.deployer;
* ====================================================================
*/
import org.apache.maven.project.Project;
import org.apache.maven.wagon.repository.Repository;
import org.apache.maven.wagon.repository.RepositoryPermissions;
import org.apache.maven.wagon.authentication.AuthenticationInfo;
import org.apache.maven.wagon.proxy.ProxyInfo;
import org.apache.maven.MavenConstants;
import org.apache.maven.MavenException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.maven.MavenException;
import org.apache.maven.project.Project;
import org.apache.maven.wagon.authentication.AuthenticationInfo;
import org.apache.maven.wagon.providers.sshext.ScpExternalWagon;
import org.apache.maven.wagon.providers.ftp.FtpWagon;
import org.apache.maven.wagon.proxy.ProxyInfo;
import org.apache.maven.wagon.repository.Repository;
import org.apache.maven.wagon.repository.RepositoryPermissions;
import java.net.MalformedURLException;
@@ -66,7 +67,7 @@ public class RepositoryBuilder
}
catch ( NumberFormatException e )
{
LOG.warn("Invalid format for port: " + port);
LOG.warn( "Invalid format for port: " + port );
}
}
@@ -90,54 +91,82 @@ public class RepositoryBuilder
permissions.setGroup( remoteGroup );
repository.setPermissions( permissions );
// TODO: provider specific settings
/*
return repository;
}
public static void configureFtpWagon( Project project, String id, FtpWagon wagon )
{
/* TODO: implement in FTP wagon
String passiveModeOn = (String) project.getContext().getVariable( "maven.repo." + id + ".passiveModeOn" );
String compress = (String) project.getContext().getVariable( "maven.repo." + id + ".compress" );
String scpExe = (String) project.getContext().getVariable( "maven.repo." + id + ".scp.executable" );
if ( scpExe == null )
{
scpExe = (String) project.getContext().getVariable( "maven.scp.executable" );
}
String scpArgs = (String) project.getContext().getVariable( "maven.repo." + id + ".scp.args" );
if ( scpArgs == null )
{
scpArgs = (String) project.getContext().getVariable( "maven.scp.args" );
}
String sshExe = (String) project.getContext().getVariable( "maven.repo." + id + ".ssh.executable" );
if ( sshExe == null )
{
sshExe = (String) project.getContext().getVariable( "maven.ssh.executable" );
}
String sshArgs = (String) project.getContext().getVariable( "maven.repo." + id + ".ssh.args" );
if ( sshArgs == null )
{
sshArgs = (String) project.getContext().getVariable( "maven.ssh.args" );
}
if ( passiveModeOn != null )
{
if ( "false".equalsIgnoreCase( passiveModeOn ) )
{
repoInfo.setPassiveModeOn( false );
wagon.setPassiveModeOn( false );
}
}
if ( compress != null )
{
try
{
repoInfo.setCompress( new Boolean( compress ).booleanValue() );
wagon.setCompress( new Boolean( compress ).booleanValue() );
}
catch ( Exception e )
{
throw new MalformedURLException( "maven.repo." + id + ".compress should be a boolean" );
throw new MavenException( "maven.repo." + id + ".compress should be a boolean" );
}
}
*/
}
return repository;
public static void configureSshExternalWagon( Project project, String id, ScpExternalWagon wagon )
{
String scpExe = (String) project.getContext().getVariable( "maven.repo." + id + ".scp.executable" );
if ( scpExe == null )
{
scpExe = (String) project.getContext().getVariable( "maven.scp.executable" );
}
if ( scpExe != null )
{
wagon.setScpExecutable( scpExe );
}
String scpArgs = (String) project.getContext().getVariable( "maven.repo." + id + ".scp.args" );
if ( scpArgs == null )
{
scpArgs = (String) project.getContext().getVariable( "maven.scp.args" );
}
if ( scpArgs != null )
{
wagon.setScpArgs( scpArgs );
}
String sshExe = (String) project.getContext().getVariable( "maven.repo." + id + ".ssh.executable" );
if ( sshExe == null )
{
sshExe = (String) project.getContext().getVariable( "maven.ssh.executable" );
}
if ( sshExe != null )
{
wagon.setSshExecutable( sshExe );
}
String sshArgs = (String) project.getContext().getVariable( "maven.repo." + id + ".ssh.args" );
if ( sshArgs == null )
{
sshArgs = (String) project.getContext().getVariable( "maven.ssh.args" );
}
if ( sshArgs != null )
{
wagon.setSshArgs( sshArgs );
}
}
public static void getProxyInfo( Project project )
@@ -157,15 +186,15 @@ public class RepositoryBuilder
}
catch ( NumberFormatException e )
{
LOG.warn("Invalid format for port: " + proxyPort);
LOG.warn( "Invalid format for port: " + proxyPort );
}
}
proxyInfo.setType( "http" );
proxyInfo.setHost( proxyHost );
proxyInfo.setNonProxyHosts( (String) project.getContext().getVariable( "maven.proxy.nonProxyHosts" ));
proxyInfo.setNtlmDomain( (String) project.getContext().getVariable( "maven.proxy.ntlm.domain" ));
proxyInfo.setNtlmHost( (String) project.getContext().getVariable( "maven.proxy.ntlm.host" ));
proxyInfo.setNonProxyHosts( (String) project.getContext().getVariable( "maven.proxy.nonProxyHosts" ) );
proxyInfo.setNtlmDomain( (String) project.getContext().getVariable( "maven.proxy.ntlm.domain" ) );
proxyInfo.setNtlmHost( (String) project.getContext().getVariable( "maven.proxy.ntlm.host" ) );
proxyInfo.setUserName( proxyUser );
proxyInfo.setPassword( proxyPassword );
}