maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aherit...@apache.org
Subject svn commit: r409253 - in /maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer: DefaultArtifactDeployer.java RepositoryBuilder.java
Date Wed, 24 May 2006 21:16:14 GMT
Author: aheritier
Date: Wed May 24 14:16:13 2006
New Revision: 409253

URL: http://svn.apache.org/viewvc?rev=409253&view=rev
Log:
For ssh based protocols, do not check host keys (required in the new version of wagon - In
the future we'll be able to add settings to allow users to check them).

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/viewvc/maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java?rev=409253&r1=409252&r2=409253&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
Wed May 24 14:16:13 2006
@@ -424,39 +424,32 @@
     private Wagon getWagon( String protocol, Project project, String id )
         throws MalformedURLException
     {
-        if ( protocol.equals( "http" ) )
-        {
-            return new HttpWagon();
-        }
-        else if ( protocol.equals( "ftp" ) )
-        {
-            FtpWagon ftpWagon = new FtpWagon();
-            RepositoryBuilder.configureFtpWagon( project, id, ftpWagon );
-            return ftpWagon;
-        }
-        else if ( protocol.equals( "sftp" ) )
-        {
-            return new SftpWagon();
-        }
-        else if ( protocol.equals( "file" ) )
-        {
-            return new FileWagon();
-        }
-        else if ( protocol.equals( "scp" ) )
-        {
-            return new ScpWagon();
-        }
-        else if ( protocol.equals( "scpexe" ) )
-        {
-            ScpExternalWagon scpExternalWagon = new ScpExternalWagon();
-            RepositoryBuilder.configureSshExternalWagon( project, id, scpExternalWagon );
-            return scpExternalWagon;
-        }
-        else
-        {
-            throw new MalformedURLException( "Unknown Wagon protocol: " + protocol );
-        }
-    }
+		Wagon wagon;
+	
+		if (protocol.equals("http")) {
+			wagon = new HttpWagon();
+		} else if (protocol.equals("ftp")) {
+			wagon = new FtpWagon();
+			RepositoryBuilder.configureFtpWagon(project, id, (FtpWagon) wagon);
+		} else if (protocol.equals("sftp")) {
+			wagon = new SftpWagon();
+		} else if (protocol.equals("file")) {
+			wagon = new FileWagon();
+		} else if (protocol.equals("scp")) {
+			wagon = new ScpWagon();
+			RepositoryBuilder.configureScpWagon(project, id, (ScpWagon) wagon);
+		} else if (protocol.equals("scpexe")) {
+			wagon = new ScpExternalWagon();
+			RepositoryBuilder.configureSshExternalWagon(project, id,
+					(ScpExternalWagon) wagon);
+			return wagon;
+		} else {
+			throw new MalformedURLException("Unknown Wagon protocol: "
+					+ protocol);
+		}
+	
+		return wagon;
+	}
 
     private String getSnapshotSignature()
     {

Modified: maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/RepositoryBuilder.java
URL: http://svn.apache.org/viewvc/maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/RepositoryBuilder.java?rev=409253&r1=409252&r2=409253&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
Wed May 24 14:16:13 2006
@@ -23,6 +23,10 @@
 import org.apache.maven.project.Project;
 import org.apache.maven.wagon.authentication.AuthenticationInfo;
 import org.apache.maven.wagon.providers.ftp.FtpWagon;
+import org.apache.maven.wagon.providers.ssh.AbstractSshWagon;
+import org.apache.maven.wagon.providers.ssh.ScpWagon;
+import org.apache.maven.wagon.providers.ssh.SftpWagon;
+import org.apache.maven.wagon.providers.ssh.knownhost.NullKnownHostProvider;
 import org.apache.maven.wagon.providers.sshext.ScpExternalWagon;
 import org.apache.maven.wagon.proxy.ProxyInfo;
 import org.apache.maven.wagon.repository.Repository;
@@ -130,6 +134,25 @@
 */
     }
 
+    public static void configureSshWagon( Project project, String id, AbstractSshWagon wagon
)
+    {
+    	// DON'T check host key
+    	// To do it we need to had more configuration settings (know_hosts file, ...)
+    	NullKnownHostProvider nkhp = new NullKnownHostProvider();
+    	nkhp.setHostKeyChecking("no");
+    	wagon.setKnownHostsProvider(nkhp);
+    }
+
+    public static void configureSftpWagon( Project project, String id, SftpWagon wagon )
+    {
+    	configureSshWagon(project,id,wagon);
+    }
+    
+    public static void configureScpWagon( Project project, String id, ScpWagon wagon )
+    {
+    	configureSshWagon(project,id,wagon);
+    }
+    
     public static void configureSshExternalWagon( Project project, String id, ScpExternalWagon
wagon )
     {
         String scpExe = (String) project.getContext().getVariable( "maven.repo." + id + ".scp.executable"
);



Mime
View raw message