use of org.bndtools.build.api.IProjectDecorator.BndProjectInfo in project bndtools by bndtools.
the class BndConfigurator method execJarMojo.
private void execJarMojo(final IMavenProjectFacade projectFacade, IProgressMonitor monitor) throws CoreException {
final IMaven maven = MavenPlugin.getMaven();
ProjectRegistryManager projectRegistryManager = MavenPluginActivator.getDefault().getMavenProjectManagerImpl();
ResolverConfiguration resolverConfiguration = new ResolverConfiguration();
resolverConfiguration.setResolveWorkspaceProjects(true);
IMavenExecutionContext context = projectRegistryManager.createExecutionContext(projectFacade.getPom(), resolverConfiguration);
context.execute(new ICallable<Void>() {
@Override
public Void call(IMavenExecutionContext context, IProgressMonitor monitor) throws CoreException {
SubMonitor progress = SubMonitor.convert(monitor);
MavenProject mavenProject = getMavenProject(projectFacade, progress.newChild(1));
MavenExecutionPlan plan = maven.calculateExecutionPlan(mavenProject, Arrays.asList("jar:jar"), true, monitor);
List<MojoExecution> mojoExecutions = plan.getMojoExecutions();
if (mojoExecutions != null) {
for (MojoExecution mojoExecution : mojoExecutions) {
maven.execute(mavenProject, mojoExecution, progress.newChild(1));
}
}
// We can now decorate based on the build we just did.
try {
IProjectDecorator decorator = Injector.ref.get();
if (decorator != null) {
BndProjectInfo info = new MavenProjectInfo(mavenProject);
decorator.updateDecoration(projectFacade.getProject(), info);
}
} catch (Exception e) {
logger.logError("Failed to decorate project " + projectFacade.getProject().getName(), e);
}
return null;
}
}, monitor);
}
Aggregations