use of org.eclipse.m2e.core.project.IProjectConfigurationManager in project liferay-ide by liferay.
the class MavenUtil method importProject.
public static List<IMavenProjectImportResult> importProject(String location, IProgressMonitor monitor) throws CoreException, InterruptedException {
MavenModelManager mavenModelManager = MavenPlugin.getMavenModelManager();
IWorkspaceRoot workspaceRoot = CoreUtil.getWorkspaceRoot();
File root = workspaceRoot.getLocation().toFile();
AbstractProjectScanner<MavenProjectInfo> scanner = new LocalProjectScanner(root, location, false, mavenModelManager);
scanner.run(monitor);
List<MavenProjectInfo> projects = scanner.getProjects();
List<MavenProjectInfo> mavenProjects = new ArrayList<>();
_findChildMavenProjects(mavenProjects, projects);
mavenProjects = _filterProjects(mavenProjects);
ProjectImportConfiguration importConfiguration = new ProjectImportConfiguration();
IProjectConfigurationManager projectConfigurationManager = MavenPlugin.getProjectConfigurationManager();
return projectConfigurationManager.importProjects(mavenProjects, importConfiguration, monitor);
}
use of org.eclipse.m2e.core.project.IProjectConfigurationManager in project liferay-ide by liferay.
the class LiferayMavenProjectCustomJSPValidationTest method testCustomJspValidationConfigured.
@Test
@Ignore
public void testCustomJspValidationConfigured() throws Exception {
final IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(LiferayMavenCore.PLUGIN_ID);
;
prefs.putBoolean(LiferayMavenCore.PREF_DISABLE_CUSTOM_JSP_VALIDATION, true);
IProject project = importProject("projects/configurators/customJspValidation/pom.xml");
assertNotNull(project);
IMavenProjectFacade facade = MavenPlugin.getMavenProjectRegistry().create(project, monitor);
assertNotNull(facade);
assertTrue(CoreUtil.isLiferayProject(project));
final IProjectConfigurationManager projectConfigurationManager = MavenPlugin.getProjectConfigurationManager();
projectConfigurationManager.updateProjectConfiguration(new MavenUpdateRequest(project, mavenConfiguration.isOffline(), true), monitor);
waitForBuildAndValidation(project);
final IMarker[] markers = project.findMarkers("org.eclipse.jst.jsp.core.validationMarker", true, IResource.DEPTH_INFINITE);
for (IMarker marker : markers) {
assertEquals(false, marker.getAttribute(IMarker.SEVERITY).equals(IMarker.SEVERITY_ERROR));
}
project.delete(true, monitor);
}
use of org.eclipse.m2e.core.project.IProjectConfigurationManager in project jbosstools-openshift by jbosstools.
the class MavenProjectImportOperation method importToWorkspace.
public List<IProject> importToWorkspace(IProgressMonitor monitor) throws CoreException, InterruptedException {
MavenPluginActivator mavenPlugin = MavenPluginActivator.getDefault();
IProjectConfigurationManager configurationManager = mavenPlugin.getProjectConfigurationManager();
MavenModelManager modelManager = mavenPlugin.getMavenModelManager();
Set<MavenProjectInfo> projectInfos = getMavenProjects(getProjectDirectory(), filters, modelManager, monitor);
ProjectImportConfiguration projectImportConfiguration = new ProjectImportConfiguration();
if (overwriteMavenProjects(projectInfos, projectImportConfiguration, monitor)) {
List<IMavenProjectImportResult> importResults = configurationManager.importProjects(projectInfos, projectImportConfiguration, monitor);
return validate(toProjects(importResults));
} else {
return Collections.emptyList();
}
}
use of org.eclipse.m2e.core.project.IProjectConfigurationManager in project mdw-designer by CenturyLinkCloud.
the class ProjectConfigurator method addMavenNature.
@SuppressWarnings("deprecation")
public void addMavenNature(IProgressMonitor monitor) throws CoreException {
ResolverConfiguration configuration = new ResolverConfiguration();
configuration.setResolveWorkspaceProjects(false);
configuration.setActiveProfiles("");
IProjectConfigurationManager configurationManager = MavenPlugin.getProjectConfigurationManager();
configurationManager.enableMavenNature(project.getSourceProject(), configuration, monitor);
configurationManager.updateProjectConfiguration(project.getSourceProject(), monitor);
}
use of org.eclipse.m2e.core.project.IProjectConfigurationManager in project liferay-ide by liferay.
the class LiferayMavenProjectCustomJSPValidationTest method testNoCustomJspValidationConfigured.
@Test
@Ignore
public void testNoCustomJspValidationConfigured() throws Exception {
final IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(LiferayMavenCore.PLUGIN_ID);
;
prefs.putBoolean(LiferayMavenCore.PREF_DISABLE_CUSTOM_JSP_VALIDATION, false);
IProject project = importProject("projects/configurators/customJspValidation/pom.xml");
assertNotNull(project);
IMavenProjectFacade facade = MavenPlugin.getMavenProjectRegistry().create(project, monitor);
assertNotNull(facade);
assertTrue(CoreUtil.isLiferayProject(project));
final IProjectConfigurationManager projectConfigurationManager = MavenPlugin.getProjectConfigurationManager();
projectConfigurationManager.updateProjectConfiguration(new MavenUpdateRequest(project, mavenConfiguration.isOffline(), true), monitor);
waitForBuildAndValidation(project);
final IMarker[] markers = project.findMarkers("org.eclipse.jst.jsp.core.validationMarker", true, IResource.DEPTH_INFINITE);
for (IMarker marker : markers) {
assertEquals(true, marker.getAttribute(IMarker.SEVERITY).equals(IMarker.SEVERITY_ERROR));
}
project.delete(true, monitor);
}
Aggregations