Example usage for org.apache.maven.artifact.manager WagonConfigurationException WagonConfigurationException

List of usage examples for org.apache.maven.artifact.manager WagonConfigurationException WagonConfigurationException

Introduction

In this page you can find the example usage for org.apache.maven.artifact.manager WagonConfigurationException WagonConfigurationException.

Prototype

public WagonConfigurationException(String repositoryId, String message, Throwable cause) 

Source Link

Usage

From source file:com.opoopress.maven.plugins.plugin.AbstractDeployMojo.java

License:Apache License

/**
 * Configure the Wagon with the information from serverConfigurationMap ( which comes from settings.xml )
 *
 * @param wagon//from  w w w .j  av  a 2 s.c o  m
 * @param repositoryId
 * @param settings
 * @param container
 * @param log
 * @throws WagonConfigurationException
 * @todo Remove when {@link WagonManager#getWagon(Repository) is available}. It's available in Maven 2.0.5.
 */
private static void configureWagon(Wagon wagon, String repositoryId, Settings settings,
        PlexusContainer container, Log log) throws WagonConfigurationException {
    log.debug(" configureWagon ");

    //config log
    configureLog(wagon, log);

    configureScpWagonIfRequired(wagon, log);

    // MSITE-25: Make sure that the server settings are inserted
    for (Server server : settings.getServers()) {
        String id = server.getId();

        log.debug("configureWagon server " + id);

        if (id != null && id.equals(repositoryId) && (server.getConfiguration() != null)) {
            final PlexusConfiguration plexusConf = new XmlPlexusConfiguration(
                    (Xpp3Dom) server.getConfiguration());

            ComponentConfigurator componentConfigurator = null;
            try {
                componentConfigurator = (ComponentConfigurator) container.lookup(ComponentConfigurator.ROLE);
                componentConfigurator.configureComponent(wagon, plexusConf, container.getContainerRealm());
            } catch (final ComponentLookupException e) {
                throw new WagonConfigurationException(repositoryId,
                        "Unable to lookup wagon configurator." + " Wagon configuration cannot be applied.", e);
            } catch (ComponentConfigurationException e) {
                throw new WagonConfigurationException(repositoryId, "Unable to apply wagon configuration.", e);
            } finally {
                if (componentConfigurator != null) {
                    try {
                        container.release(componentConfigurator);
                    } catch (ComponentLifecycleException e) {
                        log.error("Problem releasing configurator - ignoring: " + e.getMessage());
                    }
                }
            }
        }
    }
}

From source file:de.faustedition.maven.OddSchemaDeployMojo.java

License:Apache License

/**
 * Configure the Wagon with the information from serverConfigurationMap
 * ( which comes from settings.xml )//w w  w  .  j  a v a 2  s  .  co  m
 * 
 * @todo Remove when {@link WagonManager#getWagon(Repository) is
 *       available}. It's available in Maven 2.0.5.
 * @param wagon
 * @param repositoryId
 * @param settings
 * @param container
 * @param log
 * @throws WagonConfigurationException
 */
static void configureWagon(Wagon wagon, String repositoryId, Settings settings, PlexusContainer container,
        Log log) throws WagonConfigurationException {
    // MSITE-25: Make sure that the server settings are inserted
    for (int i = 0; i < settings.getServers().size(); i++) {
        Server server = (Server) settings.getServers().get(i);
        String id = server.getId();
        if (id != null && id.equals(repositoryId)) {
            if (server.getConfiguration() != null) {
                final PlexusConfiguration plexusConf = new XmlPlexusConfiguration(
                        (Xpp3Dom) server.getConfiguration());

                ComponentConfigurator componentConfigurator = null;
                try {
                    componentConfigurator = (ComponentConfigurator) container
                            .lookup(ComponentConfigurator.ROLE);
                    componentConfigurator.configureComponent(wagon, plexusConf, container.getContainerRealm());
                } catch (final ComponentLookupException e) {
                    throw new WagonConfigurationException(repositoryId,
                            "Unable to lookup wagon configurator." + " Wagon configuration cannot be applied.",
                            e);
                } catch (ComponentConfigurationException e) {
                    throw new WagonConfigurationException(repositoryId, "Unable to apply wagon configuration.",
                            e);
                } finally {
                    if (componentConfigurator != null) {
                        try {
                            container.release(componentConfigurator);
                        } catch (ComponentLifecycleException e) {
                            log.error("Problem releasing configurator - ignoring: " + e.getMessage());
                        }
                    }
                }

            }

        }
    }
}