Index: src/java/org/apache/maven/verifier/DependencyVerifier.java =================================================================== --- src/java/org/apache/maven/verifier/DependencyVerifier.java (revision 280184) +++ src/java/org/apache/maven/verifier/DependencyVerifier.java (working copy) @@ -32,6 +32,7 @@ import org.apache.maven.wagon.events.TransferListener; import org.apache.maven.wagon.providers.file.FileWagon; import org.apache.maven.wagon.providers.http.HttpWagon; +import org.apache.maven.wagon.providers.ssh.SftpWagon; import org.apache.maven.wagon.proxy.ProxyInfo; import org.apache.maven.wagon.repository.Repository; import org.codehaus.plexus.util.StringUtils; @@ -43,6 +44,7 @@ import java.util.Map; import java.util.Set; import java.util.HashSet; +import java.util.HashMap; /** * Make sure that everything that is required for the project to build @@ -369,16 +371,8 @@ Repository repository = new Repository( "repo" + count, remoteRepo.trim() ); - // TODO: would like not to have to initialise the wagons all the time - use a session - Wagon wagon; - if ( repository.getProtocol().equals( "http" ) ) - { - wagon = new HttpWagon(); - } - else - { - wagon = new FileWagon(); - } + final Wagon wagon = new DefaultWagonFactory().getWagon( + repository.getProtocol() ); if ( listener != null ) { @@ -451,5 +445,48 @@ // V E R I F I C A T I O N // ---------------------------------------------------------------------- + /** + * Creates Wagons. Replace it with a IoC container? + */ + private static class DefaultWagonFactory { + + /** log for debug output */ + private static final Log log = LogFactory + .getLog(DefaultWagonFactory.class); + private final Map /* > */map = new HashMap(); + + public DefaultWagonFactory() + { + map.put( "http", HttpWagon.class ); + map.put( "sftp", SftpWagon.class ); + map.put( "file", FileWagon.class ); + } + + public final Wagon getWagon( final String protocol ) + { + // TODO: would like not to have to initialise the wagons all the time - use a session + Wagon ret; + final Class aClass = (Class)map.get( protocol ); + if ( aClass == null ) + { + log.info( "Unknown protocol: `" + protocol + + "'. Trying file wagon" ); + ret = new FileWagon(); + } + else + { + try + { + ret = (Wagon) aClass.newInstance(); + } + catch ( final Exception e ) + { + throw new RuntimeException(e); + } + } + + return ret; + } + } } Index: project.xml =================================================================== --- project.xml (revision 280184) +++ project.xml (working copy) @@ -588,6 +588,12 @@ wagon-file 1.0-alpha-3 + + org.apache.maven.wagon + wagon-ssh + 1.0-alpha-5-SNAPSHOT + + commons-beanutils