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 )
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()
{

View File

@ -23,6 +23,10 @@ import org.apache.maven.MavenException;
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 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 )
{
String scpExe = (String) project.getContext().getVariable( "maven.repo." + id + ".scp.executable" );