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).

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@409253 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
aheritier 2006-05-24 21:16:13 +00:00
parent 997c8359a8
commit c07ed387cd
2 changed files with 49 additions and 33 deletions

View File

@ -424,39 +424,32 @@ public class DefaultArtifactDeployer
private Wagon getWagon( String protocol, Project project, String id ) private Wagon getWagon( String protocol, Project project, String id )
throws MalformedURLException throws MalformedURLException
{ {
if ( protocol.equals( "http" ) ) Wagon wagon;
{
return new HttpWagon(); if (protocol.equals("http")) {
} wagon = new HttpWagon();
else if ( protocol.equals( "ftp" ) ) } else if (protocol.equals("ftp")) {
{ wagon = new FtpWagon();
FtpWagon ftpWagon = new FtpWagon(); RepositoryBuilder.configureFtpWagon(project, id, (FtpWagon) wagon);
RepositoryBuilder.configureFtpWagon( project, id, ftpWagon ); } else if (protocol.equals("sftp")) {
return ftpWagon; wagon = new SftpWagon();
} } else if (protocol.equals("file")) {
else if ( protocol.equals( "sftp" ) ) wagon = new FileWagon();
{ } else if (protocol.equals("scp")) {
return new SftpWagon(); wagon = new ScpWagon();
} RepositoryBuilder.configureScpWagon(project, id, (ScpWagon) wagon);
else if ( protocol.equals( "file" ) ) } else if (protocol.equals("scpexe")) {
{ wagon = new ScpExternalWagon();
return new FileWagon(); RepositoryBuilder.configureSshExternalWagon(project, id,
} (ScpExternalWagon) wagon);
else if ( protocol.equals( "scp" ) ) return wagon;
{ } else {
return new ScpWagon(); throw new MalformedURLException("Unknown Wagon protocol: "
} + protocol);
else if ( protocol.equals( "scpexe" ) ) }
{
ScpExternalWagon scpExternalWagon = new ScpExternalWagon(); return wagon;
RepositoryBuilder.configureSshExternalWagon( project, id, scpExternalWagon ); }
return scpExternalWagon;
}
else
{
throw new MalformedURLException( "Unknown Wagon protocol: " + protocol );
}
}
private String getSnapshotSignature() private String getSnapshotSignature()
{ {

View File

@ -23,6 +23,10 @@ import org.apache.maven.MavenException;
import org.apache.maven.project.Project; import org.apache.maven.project.Project;
import org.apache.maven.wagon.authentication.AuthenticationInfo; import org.apache.maven.wagon.authentication.AuthenticationInfo;
import org.apache.maven.wagon.providers.ftp.FtpWagon; 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.providers.sshext.ScpExternalWagon;
import org.apache.maven.wagon.proxy.ProxyInfo; import org.apache.maven.wagon.proxy.ProxyInfo;
import org.apache.maven.wagon.repository.Repository; import org.apache.maven.wagon.repository.Repository;
@ -130,6 +134,25 @@ public class RepositoryBuilder
*/ */
} }
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 ) public static void configureSshExternalWagon( Project project, String id, ScpExternalWagon wagon )
{ {
String scpExe = (String) project.getContext().getVariable( "maven.repo." + id + ".scp.executable" ); String scpExe = (String) project.getContext().getVariable( "maven.repo." + id + ".scp.executable" );