use of org.eclipse.m2e.core.embedder.ICallable in project liferay-ide by liferay.
the class ThemePluginBuildParticipant method build.
@Override
public Set<IProject> build(int kind, IProgressMonitor monitor) throws Exception {
IMavenProjectFacade facade = getMavenProjectFacade();
if (!shouldBuild(kind, facade)) {
return null;
}
ICallable<IStatus> callable = new ICallable<IStatus>() {
public IStatus call(IMavenExecutionContext context, IProgressMonitor monitor) throws CoreException {
return executeThemeMojo(facade, context, monitor);
}
};
IStatus retval = null;
try {
retval = executeMaven(facade, callable, monitor);
} catch (Exception e) {
retval = LiferayMavenCore.createErrorStatus(getGoal() + " build error", e);
}
if ((retval != null) && !retval.isOK()) {
LiferayMavenCore.log(retval);
}
try {
facade.getProject().refreshLocal(IResource.DEPTH_INFINITE, monitor);
} catch (CoreException ce) {
}
monitor.worked(10);
return null;
}
use of org.eclipse.m2e.core.embedder.ICallable in project liferay-ide by liferay.
the class MavenProjectBuilder method execGoals.
public IStatus execGoals(List<String> goals, IProgressMonitor monitor) throws CoreException {
IStatus retval = null;
IMavenProjectFacade facade = MavenUtil.getProjectFacade(getProject(), monitor);
ICallable<IStatus> callable = new ICallable<IStatus>() {
public IStatus call(IMavenExecutionContext context, IProgressMonitor monitor) throws CoreException {
IStatus execStatus = MavenUtil.executeGoals(facade, context, goals, monitor);
MavenSession session = context.getSession();
List<Throwable> exceptions = session.getResult().getExceptions();
MultiStatusBuilder multiStatusBuilder = LiferayMavenCore.newMultiStatus();
multiStatusBuilder.add(execStatus);
multiStatusBuilder.addAll(exceptions);
return multiStatusBuilder.retval();
}
};
retval = executeMaven(facade, callable, monitor);
return retval;
}
use of org.eclipse.m2e.core.embedder.ICallable in project liferay-ide by liferay.
the class MavenProjectBuilder method buildLang.
public IStatus buildLang(IFile langFile, IProgressMonitor monitor) throws CoreException {
IProgressMonitor sub = SubMonitor.convert(monitor, 100);
sub.beginTask(Msgs.buildingLanguages, 100);
IMavenProjectFacade facade = MavenUtil.getProjectFacade(getProject(), sub);
sub.worked(10);
ICallable<IStatus> callable = new ICallable<IStatus>() {
public IStatus call(IMavenExecutionContext context, IProgressMonitor monitor) throws CoreException {
return MavenUtil.executeMojoGoal(facade, context, ILiferayMavenConstants.PLUGIN_GOAL_BUILD_LANG, monitor);
}
};
IStatus retval = executeMaven(facade, callable, sub);
sub.worked(80);
getProject().refreshLocal(IResource.DEPTH_INFINITE, sub);
sub.worked(10);
sub.done();
return retval;
}
use of org.eclipse.m2e.core.embedder.ICallable in project liferay-ide by liferay.
the class MavenProjectBuilder method execJarMojo.
public IStatus execJarMojo(IMavenProjectFacade projectFacade, IProgressMonitor monitor) throws CoreException {
IStatus retval = null;
ICallable<IStatus> callable = new ICallable<IStatus>() {
public IStatus call(IMavenExecutionContext context, IProgressMonitor monitor) throws CoreException {
MavenProject mavenProject = projectFacade.getMavenProject();
if (mavenProject == null) {
mavenProject = projectFacade.getMavenProject(monitor);
}
IMaven maven = MavenPlugin.getMaven();
MavenExecutionPlan plan = maven.calculateExecutionPlan(mavenProject, Arrays.asList("jar:jar"), true, monitor);
List<MojoExecution> mojoExecutions = plan.getMojoExecutions();
if (mojoExecutions != null) {
for (MojoExecution mojoExecution : mojoExecutions) {
MavenPlugin.getMaven().execute(mavenProject, mojoExecution, monitor);
}
}
return Status.OK_STATUS;
}
};
retval = executeMaven(projectFacade, callable, monitor);
return retval;
}
Aggregations