{
throw new MojoExecutionException( "The URL to the site is missing in the project descriptor." );
}
getLog().debug( "The site will be deployed to '" + url + "'");
Repository repository = new Repository( id, url );
// TODO: work on moving this into the deployer like the other deploy methods
Wagon wagon;
try
{
wagon = wagonManager.getWagon( repository );
configureWagon( wagon, repository.getId(), settings, container, getLog() );
}
catch ( UnsupportedProtocolException e )
{
throw new MojoExecutionException( "Unsupported protocol: '" + repository.getProtocol() + "'", e );
}
catch ( WagonConfigurationException e )
{
throw new MojoExecutionException( "Unable to configure Wagon: '" + repository.getProtocol() + "'", e );
}
if ( !wagon.supportsDirectoryCopy() )
{
throw new MojoExecutionException(
"Wagon protocol '" + repository.getProtocol() + "' doesn't support directory copying" );
}
try
{
Debug debug = new Debug();
wagon.addSessionListener( debug );
wagon.addTransferListener( debug );
/*
FIXME proxy Info
ProxyInfo proxyInfo = getProxyInfo( repository, wagonManager );
if ( proxyInfo != null )
{
wagon.connect( repository, wagonManager.getAuthenticationInfo( id ), proxyInfo );
}
else
{
wagon.connect( repository, wagonManager.getAuthenticationInfo( id ) );
}
*/
wagon.connect( repository );
wagon.putDirectory( inputDirectory, "." );
if ( chmod && wagon instanceof CommandExecutor )
{
CommandExecutor exec = (CommandExecutor) wagon;
exec.executeCommand( "chmod " + chmodOptions + " " + chmodMode + " " + repository.getBasedir() );
}
}
catch ( ResourceDoesNotExistException e )
{
throw new MojoExecutionException( "Error uploading site", e );