use of org.codehaus.plexus.component.configurator.ComponentConfigurationException in project flyway by flyway.
the class IncludeProjectDependenciesComponentConfigurator method addProjectDependenciesToClassRealm.
@SuppressWarnings({ "unchecked" })
private void addProjectDependenciesToClassRealm(ExpressionEvaluator expressionEvaluator, ClassRealm containerRealm) throws ComponentConfigurationException {
List<String> classpathElements;
try {
classpathElements = (List<String>) expressionEvaluator.evaluate("${project.testClasspathElements}");
} catch (ExpressionEvaluationException e) {
throw new ComponentConfigurationException("There was a problem evaluating: ${project.testClasspathElements}", e);
}
// Add the project dependencies to the ClassRealm
final URL[] urls = buildURLs(classpathElements);
for (URL url : urls) {
containerRealm.addConstituent(url);
}
}
use of org.codehaus.plexus.component.configurator.ComponentConfigurationException in project maven-plugins by apache.
the class AbstractDeployMojo method configureWagon.
/**
* Configure the Wagon with the information from serverConfigurationMap ( which comes from settings.xml )
*
* @param wagon
* @param repositoryId
* @param settings
* @param container
* @param log
* @throws TransferFailedException
* @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 TransferFailedException {
log.debug(" configureWagon ");
// 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, "basic");
if (isMaven3OrMore()) {
componentConfigurator.configureComponent(wagon, plexusConf, container.getContainerRealm());
} else {
configureWagonWithMaven2(componentConfigurator, wagon, plexusConf, container);
}
} catch (final ComponentLookupException e) {
throw new TransferFailedException("While configuring wagon for \'" + repositoryId + "\': Unable to lookup wagon configurator." + " Wagon configuration cannot be applied.", e);
} catch (ComponentConfigurationException e) {
throw new TransferFailedException("While configuring wagon for \'" + 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());
}
}
}
}
}
}
use of org.codehaus.plexus.component.configurator.ComponentConfigurationException in project maven-plugins by apache.
the class DefaultAssemblyArchiver method configureContainerDescriptorHandler.
private void configureContainerDescriptorHandler(final ContainerDescriptorHandler handler, final Xpp3Dom config, final AssemblerConfigurationSource configSource) throws InvalidAssemblerConfigurationException {
getLogger().debug("Configuring handler: '" + handler.getClass().getName() + "' -->");
try {
configureComponent(handler, config, configSource);
} catch (final ComponentConfigurationException e) {
throw new InvalidAssemblerConfigurationException("Failed to configure handler: " + handler.getClass().getName(), e);
} catch (final ComponentLookupException e) {
throw new InvalidAssemblerConfigurationException("Failed to lookup configurator for setup of handler: " + handler.getClass().getName(), e);
}
getLogger().debug("-- end configuration --");
}
use of org.codehaus.plexus.component.configurator.ComponentConfigurationException in project swagger-core by swagger-api.
the class IncludeProjectDependenciesComponentConfigurator method addProjectDependenciesToClassRealm.
private void addProjectDependenciesToClassRealm(ExpressionEvaluator expressionEvaluator, ClassRealm containerRealm) throws ComponentConfigurationException {
List<String> compileClasspathElements;
try {
// noinspection unchecked
compileClasspathElements = (List<String>) expressionEvaluator.evaluate("${project.compileClasspathElements}");
} catch (ExpressionEvaluationException e) {
throw new ComponentConfigurationException("There was a problem evaluating: ${project.compileClasspathElements}", e);
}
// Add the project dependencies to the ClassRealm
final URL[] urls = buildURLs(compileClasspathElements);
for (URL url : urls) {
containerRealm.addURL(url);
}
}
use of org.codehaus.plexus.component.configurator.ComponentConfigurationException in project flyway by flyway.
the class IncludeProjectDependenciesComponentConfigurator method buildURLs.
private URL[] buildURLs(List<String> classpathElements) throws ComponentConfigurationException {
// Add the projects classes and dependencies
List<URL> urls = new ArrayList<URL>(classpathElements.size());
for (String element : classpathElements) {
try {
final URL url = new File(element).toURI().toURL();
urls.add(url);
} catch (MalformedURLException e) {
throw new ComponentConfigurationException("Unable to access project dependency: " + element, e);
}
}
// Add the plugin's dependencies (so Trove stuff works if Trove isn't on
return urls.toArray(new URL[urls.size()]);
}
Aggregations