use of org.codehaus.plexus.component.repository.exception.ComponentLookupException in project maven-plugins by apache.
the class DefaultAssemblyArchiver method configureArchiver.
private void configureArchiver(final Archiver archiver, final AssemblerConfigurationSource configSource) {
Xpp3Dom config;
try {
config = Xpp3DomBuilder.build(new StringReader(configSource.getArchiverConfig()));
} catch (final XmlPullParserException e) {
throw new ArchiverException("Failed to parse archiver configuration for: " + archiver.getClass().getName(), e);
} catch (final IOException e) {
throw new ArchiverException("Failed to parse archiver configuration for: " + archiver.getClass().getName(), e);
}
getLogger().debug("Configuring archiver: '" + archiver.getClass().getName() + "' -->");
try {
configureComponent(archiver, config, configSource);
} catch (final ComponentConfigurationException e) {
throw new ArchiverException("Failed to configure archiver: " + archiver.getClass().getName(), e);
} catch (final ComponentLookupException e) {
throw new ArchiverException("Failed to lookup configurator for setup of archiver: " + archiver.getClass().getName(), e);
}
getLogger().debug("-- end configuration --");
}
use of org.codehaus.plexus.component.repository.exception.ComponentLookupException in project maven-plugins by apache.
the class PdfMojo method getReports.
protected List<MavenReportExecution> getReports() throws MojoExecutionException {
if (!isMaven3OrMore()) {
getLog().error("Report generation is not supported with Maven <= 2.x");
}
MavenReportExecutorRequest mavenReportExecutorRequest = new MavenReportExecutorRequest();
mavenReportExecutorRequest.setLocalRepository(localRepository);
mavenReportExecutorRequest.setMavenSession(session);
mavenReportExecutorRequest.setProject(project);
mavenReportExecutorRequest.setReportPlugins(reportingPlugins);
MavenReportExecutor mavenReportExecutor;
try {
mavenReportExecutor = (MavenReportExecutor) container.lookup(MavenReportExecutor.class.getName());
} catch (ComponentLookupException e) {
throw new MojoExecutionException("could not get MavenReportExecutor component", e);
}
return mavenReportExecutor.buildMavenReports(mavenReportExecutorRequest);
}
use of org.codehaus.plexus.component.repository.exception.ComponentLookupException in project maven-plugins by apache.
the class AbstractSiteRenderingMojo method getReports.
protected List<MavenReportExecution> getReports() throws MojoExecutionException {
List<MavenReportExecution> allReports;
if (isMaven3OrMore()) {
// Maven 3
MavenReportExecutorRequest mavenReportExecutorRequest = new MavenReportExecutorRequest();
mavenReportExecutorRequest.setLocalRepository(localRepository);
mavenReportExecutorRequest.setMavenSession(mavenSession);
mavenReportExecutorRequest.setProject(project);
mavenReportExecutorRequest.setReportPlugins(reportingPlugins);
MavenReportExecutor mavenReportExecutor;
try {
mavenReportExecutor = (MavenReportExecutor) container.lookup(MavenReportExecutor.class.getName());
} catch (ComponentLookupException e) {
throw new MojoExecutionException("could not get MavenReportExecutor component", e);
}
allReports = mavenReportExecutor.buildMavenReports(mavenReportExecutorRequest);
} else {
// Maven 2
allReports = new ArrayList<MavenReportExecution>(reports.size());
for (MavenReport report : reports) {
allReports.add(new MavenReportExecution(report));
}
}
// filter out reports that can't be generated
List<MavenReportExecution> reportExecutions = new ArrayList<MavenReportExecution>(allReports.size());
for (MavenReportExecution exec : allReports) {
if (exec.canGenerateReport()) {
reportExecutions.add(exec);
}
}
return reportExecutions;
}
use of org.codehaus.plexus.component.repository.exception.ComponentLookupException in project tycho by eclipse.
the class UpdateSiteAssembler method packDir.
private void packDir(File sourceDir, File targetZip) {
ZipArchiver archiver;
try {
archiver = (ZipArchiver) session.lookup(ZipArchiver.ROLE, "zip");
} catch (ComponentLookupException e) {
throw new RuntimeException("Unable to resolve ZipArchiver", e);
}
archiver.setDestFile(targetZip);
try {
archiver.addDirectory(sourceDir);
archiver.createArchive();
} catch (IOException e) {
throw new RuntimeException("Error packing zip", e);
} catch (ArchiverException e) {
throw new RuntimeException("Error packing zip", e);
}
}
use of org.codehaus.plexus.component.repository.exception.ComponentLookupException in project karaf by apache.
the class DependencyHelperFactory method createDependencyHelper.
/**
* Create a new {@link DependencyHelper} based on what has been found in
* {@link org.codehaus.plexus.PlexusContainer}.
*
* @param container The Maven Plexus container to use.
* @param mavenProject The Maven project to use.
* @param mavenSession The Maven session.
* @param cacheSize Size of the artifact/file LRU cache
* @param log The log to use for the messages.
*
* @return The {@link DependencyHelper} depending of the Maven version used.
*
* @throws MojoExecutionException If the plugin execution fails.
*/
public static DependencyHelper createDependencyHelper(PlexusContainer container, MavenProject mavenProject, MavenSession mavenSession, int cacheSize, Log log) throws MojoExecutionException {
try {
final RepositorySystem system = container.lookup(RepositorySystem.class);
final RepositorySystemSession session = mavenSession.getRepositorySession();
final List<RemoteRepository> repositories = mavenProject.getRemoteProjectRepositories();
return new Dependency31Helper(repositories, session, system, cacheSize);
} catch (ComponentLookupException e) {
throw new MojoExecutionException(e.getMessage(), e);
}
}
Aggregations