Search in sources :

Example 21 with IMavenProjectFacade

use of org.eclipse.m2e.core.project.IMavenProjectFacade in project bndtools by bndtools.

the class MavenImplicitProjectRepository method mavenProjectChanged.

@Override
public void mavenProjectChanged(MavenProjectChangedEvent[] events, IProgressMonitor monitor) {
    if (events == null)
        return;
    for (MavenProjectChangedEvent event : events) {
        final IMavenProjectFacade mavenProjectFacade = event.getMavenProject();
        if (!mavenProjectFacade.getProject().equals(projectFacade.getProject()) && (event.getFlags() != MavenProjectChangedEvent.FLAG_DEPENDENCIES)) {
            continue;
        }
        createRepo(mavenProjectFacade, monitor);
    }
}
Also used : IMavenProjectFacade(org.eclipse.m2e.core.project.IMavenProjectFacade) MavenProjectChangedEvent(org.eclipse.m2e.core.project.MavenProjectChangedEvent)

Example 22 with IMavenProjectFacade

use of org.eclipse.m2e.core.project.IMavenProjectFacade in project eclipse.jdt.ls by eclipse.

the class MavenBuildSupport method collectProjects.

public void collectProjects(Collection<IProject> projects, IProject project, IProgressMonitor monitor) {
    if (!project.isOpen() || !ProjectUtils.isMavenProject(project)) {
        return;
    }
    projects.add(project);
    IMavenProjectFacade projectFacade = registry.create(project, monitor);
    if (projectFacade != null && "pom".equals(projectFacade.getPackaging())) {
        List<String> modules = projectFacade.getMavenProjectModules();
        for (String module : modules) {
            IPath pomPath = ResourcesPlugin.getWorkspace().getRoot().getFullPath().append(module).append("pom.xml");
            IFile pom = ResourcesPlugin.getWorkspace().getRoot().getFile(pomPath);
            if (pom.exists()) {
                IProject p = pom.getProject();
                if (p.isOpen()) {
                    collectProjects(projects, p, monitor);
                }
            }
        }
    }
}
Also used : IFile(org.eclipse.core.resources.IFile) IPath(org.eclipse.core.runtime.IPath) IMavenProjectFacade(org.eclipse.m2e.core.project.IMavenProjectFacade) IProject(org.eclipse.core.resources.IProject)

Example 23 with IMavenProjectFacade

use of org.eclipse.m2e.core.project.IMavenProjectFacade in project xtext-eclipse by eclipse.

the class IgnoreMavenTargetFolderContribution method isRejected.

@Override
public boolean isRejected(IFolder folder) {
    IMavenProjectFacade mavenProjectFacade = MavenPlugin.getMavenProjectRegistry().getProject(folder.getProject());
    if (mavenProjectFacade == null) {
        return false;
    }
    IPath outputLocation = mavenProjectFacade.getOutputLocation();
    if (outputLocation == null) {
        return false;
    } else if (folder.getFullPath().equals(outputLocation)) {
        return true;
    }
    IPath testOutputLocation = mavenProjectFacade.getTestOutputLocation();
    if (testOutputLocation == null) {
        return false;
    } else if (folder.getFullPath().equals(testOutputLocation)) {
        return true;
    }
    return false;
}
Also used : IPath(org.eclipse.core.runtime.IPath) IMavenProjectFacade(org.eclipse.m2e.core.project.IMavenProjectFacade)

Example 24 with IMavenProjectFacade

use of org.eclipse.m2e.core.project.IMavenProjectFacade in project liferay-ide by liferay.

the class LiferayMavenProjectConfiguratorTest method testWarPluginNoWarSourceDirConfigured.

@Test
public void testWarPluginNoWarSourceDirConfigured() throws Exception {
    IProject project = importProject("projects/configurators/bad-war-config/pom.xml");
    assertNotNull(project);
    IMavenProjectFacade facade = MavenPlugin.getMavenProjectRegistry().create(project, monitor);
    assertNotNull(facade);
    waitForJobsToComplete();
    assertTrue(LiferayCore.create(project) instanceof FacetedMavenProject);
}
Also used : FacetedMavenProject(com.liferay.ide.maven.core.FacetedMavenProject) IMavenProjectFacade(org.eclipse.m2e.core.project.IMavenProjectFacade) IProject(org.eclipse.core.resources.IProject) Test(org.junit.Test)

Example 25 with IMavenProjectFacade

use of org.eclipse.m2e.core.project.IMavenProjectFacade in project liferay-ide by liferay.

the class LiferayMavenProjectConfiguratorTest method testLiferayFacetNoLiferayPluginConfigured.

@Test
public void testLiferayFacetNoLiferayPluginConfigured() throws Exception {
    IProject project = importProject("projects/configurators/default-webapp-no-liferay-plugin/pom.xml");
    assertNotNull(project);
    IMavenProjectFacade facade = MavenPlugin.getMavenProjectRegistry().create(project, monitor);
    assertNotNull(facade);
    assertTrue(LiferayCore.create(project) instanceof FacetedMavenProject);
}
Also used : FacetedMavenProject(com.liferay.ide.maven.core.FacetedMavenProject) IMavenProjectFacade(org.eclipse.m2e.core.project.IMavenProjectFacade) IProject(org.eclipse.core.resources.IProject) Test(org.junit.Test)

Aggregations

IMavenProjectFacade (org.eclipse.m2e.core.project.IMavenProjectFacade)54 MavenProject (org.apache.maven.project.MavenProject)21 IProject (org.eclipse.core.resources.IProject)19 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)19 CoreException (org.eclipse.core.runtime.CoreException)18 IPath (org.eclipse.core.runtime.IPath)16 IFile (org.eclipse.core.resources.IFile)13 File (java.io.File)11 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)10 Path (org.eclipse.core.runtime.Path)10 IStatus (org.eclipse.core.runtime.IStatus)9 Test (org.junit.Test)9 MavenPlugin (org.eclipse.m2e.core.MavenPlugin)6 Plugin (org.apache.maven.model.Plugin)5 IFolder (org.eclipse.core.resources.IFolder)5 ICallable (org.eclipse.m2e.core.embedder.ICallable)5 IMavenExecutionContext (org.eclipse.m2e.core.embedder.IMavenExecutionContext)5 FacetedMavenProject (com.liferay.ide.maven.core.FacetedMavenProject)4 ArrayList (java.util.ArrayList)4 IMavenProjectRegistry (org.eclipse.m2e.core.project.IMavenProjectRegistry)4