use of org.eclipse.m2e.core.project.IMavenProjectFacade in project liferay-ide by liferay.
the class MavenBundlePluginProject method adapt.
@Override
public <T> T adapt(Class<T> adapterType) {
T adapter = super.adapt(adapterType);
if (adapter != null) {
return adapter;
}
IMavenProjectFacade facade = MavenUtil.getProjectFacade(getProject(), new NullProgressMonitor());
if (facade != null) {
if (IProjectBuilder.class.equals(adapterType)) {
IProjectBuilder projectBuilder = new MavenProjectBuilder(getProject());
return adapterType.cast(projectBuilder);
} else if (IRemoteServerPublisher.class.equals(adapterType)) {
IRemoteServerPublisher remoteServerPublisher = new MavenProjectRemoteServerPublisher(getProject());
return adapterType.cast(remoteServerPublisher);
} else if (IBundleProject.class.equals(adapterType)) {
return adapterType.cast(this);
}
}
return null;
}
use of org.eclipse.m2e.core.project.IMavenProjectFacade in project liferay-ide by liferay.
the class MavenBundlePluginProject method getSymbolicName.
@Override
public String getSymbolicName() throws CoreException {
String bsn = ProjectUtil.getBundleSymbolicNameFromBND(getProject());
if (!CoreUtil.empty(bsn)) {
return bsn;
}
String retval = null;
IProgressMonitor monitor = new NullProgressMonitor();
IMavenProjectFacade projectFacade = MavenUtil.getProjectFacade(getProject(), monitor);
MavenProject mavenProject = projectFacade.getMavenProject(monitor);
Artifact artifact = mavenProject.getArtifact();
File file = artifact.getFile();
if (FileUtil.exists(file) && !file.getName().equals("classes")) {
retval = new DefaultMaven2OsgiConverter().getBundleSymbolicName(artifact);
} else {
IProject project = getProject();
// fallback to project name
retval = project.getLocation().lastSegment();
}
return retval;
}
use of org.eclipse.m2e.core.project.IMavenProjectFacade in project liferay-ide by liferay.
the class MavenProjectBuilder method preBuildService.
public IFile preBuildService(IProgressMonitor monitor) throws CoreException {
IProject project = getProject();
IFile retval = getDocrootFile("WEB-INF/" + ILiferayConstants.SERVICE_XML_FILE);
if (retval == null) {
IMavenProjectFacade projectFacade = MavenUtil.getProjectFacade(project);
if (projectFacade != null) {
IProject portletProject = getPortletProject(projectFacade, monitor);
if (portletProject != null) {
retval = new MavenProjectBuilder(portletProject).getDocrootFile("WEB-INF/" + ILiferayConstants.SERVICE_XML_FILE);
}
}
}
if (retval == null) {
retval = project.getFile("service.xml");
}
return retval;
}
use of org.eclipse.m2e.core.project.IMavenProjectFacade 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.project.IMavenProjectFacade 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;
}
Aggregations