Author: brett
Date: Tue May 31 22:46:59 2005
New Revision: 179362
URL: http://svn.apache.org/viewcvs?rev=179362&view=rev
Log:
implement scpexe args
Modified:
maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java
maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/RepositoryBuilder.java
Modified:
maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java
URL:
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java?rev=179362&r1=179361&r2=179362&view=diff
==============================================================================
---
maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java
(original)
+++
maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java
Tue May 31 22:46:59 2005
@@ -180,7 +180,7 @@
{
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 @@
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 @@
}
}
- 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 @@
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 @@
}
}
- private Wagon getWagon( String protocol )
+ private Wagon getWagon( String protocol, Project project, String id )
throws MalformedURLException
{
if ( protocol.equals( "http" ) )
@@ -386,7 +386,9 @@
}
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 @@
}
else if ( protocol.equals( "scpexe" ) )
{
- return new ScpExternalWagon();
+ ScpExternalWagon scpExternalWagon = new ScpExternalWagon();
+ RepositoryBuilder.configureSshExternalWagon( project, id,
scpExternalWagon );
+ return scpExternalWagon;
}
else
{
Modified:
maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/RepositoryBuilder.java
URL:
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/RepositoryBuilder.java?rev=179362&r1=179361&r2=179362&view=diff
==============================================================================
---
maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/RepositoryBuilder.java
(original)
+++
maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/RepositoryBuilder.java
Tue May 31 22:46:59 2005
@@ -17,15 +17,16 @@
* ====================================================================
*/
+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.repository.Repository;
-import org.apache.maven.wagon.repository.RepositoryPermissions;
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.MavenConstants;
-import org.apache.maven.MavenException;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.maven.wagon.repository.Repository;
+import org.apache.maven.wagon.repository.RepositoryPermissions;
import java.net.MalformedURLException;
@@ -66,7 +67,7 @@
}
catch ( NumberFormatException e )
{
- LOG.warn("Invalid format for port: " + port);
+ LOG.warn( "Invalid format for port: " + port );
}
}
@@ -90,54 +91,82 @@
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" );
+ if ( passiveModeOn != null )
+ {
+ if ( "false".equalsIgnoreCase( passiveModeOn ) )
+ {
+ wagon.setPassiveModeOn( false );
+ }
+ }
+ if ( compress != null )
+ {
+ try
+ {
+ wagon.setCompress( new Boolean( compress ).booleanValue() );
+ }
+ catch ( Exception e )
+ {
+ throw new MavenException( "maven.repo." + id + ".compress
should be a boolean" );
+ }
+ }
+*/
+ }
+
+ 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 ( passiveModeOn != null )
+ if ( sshArgs != null )
{
- if ( "false".equalsIgnoreCase( passiveModeOn ) )
- {
- repoInfo.setPassiveModeOn( false );
- }
+ wagon.setSshArgs( sshArgs );
}
- if ( compress != null )
- {
- try
- {
- repoInfo.setCompress( new Boolean( compress ).booleanValue() );
- }
- catch ( Exception e )
- {
- throw new MalformedURLException( "maven.repo." + id +
".compress should be a boolean" );
- }
- }
-*/
-
- return repository;
}
public static void getProxyInfo( Project project )
@@ -157,15 +186,15 @@
}
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 );
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]