use of org.jetbrains.idea.maven.project.MavenProjectsManager in project intellij-community by JetBrains.
the class MavenActionUtil method getMavenProject.
@Nullable
public static MavenProject getMavenProject(DataContext context) {
MavenProject result;
final MavenProjectsManager manager = getProjectsManager(context);
if (manager == null)
return null;
final VirtualFile file = CommonDataKeys.VIRTUAL_FILE.getData(context);
if (file != null) {
result = manager.findProject(file);
if (result != null)
return result;
}
Module module = ExternalSystemActionUtil.getModule(context);
if (module != null) {
result = manager.findProject(module);
if (result != null)
return result;
}
return null;
}
use of org.jetbrains.idea.maven.project.MavenProjectsManager in project google-cloud-intellij by GoogleCloudPlatform.
the class DefaultAppEngineProjectService method isJarOrWarMavenBuild.
@Override
public boolean isJarOrWarMavenBuild(@NotNull Module module) {
MavenProjectsManager projectsManager = MavenProjectsManager.getInstance(module.getProject());
MavenProject mavenProject = projectsManager.findProject(module);
return mavenProject != null && isMavenModule(module) && ("jar".equalsIgnoreCase(mavenProject.getPackaging()) || "war".equalsIgnoreCase(mavenProject.getPackaging()));
}
use of org.jetbrains.idea.maven.project.MavenProjectsManager in project azure-tools-for-java by Microsoft.
the class MavenProjectGenerator method importMavenProject.
private Promise<MavenProject> importMavenProject() {
Project project = this.module.getProject();
String baseDirPath = project.getBasePath();
MavenProjectsManager manager = MavenProjectsManager.getInstance(project);
File pomFile = new File(baseDirPath + File.separator + "pom.xml");
VirtualFile pom = VfsUtil.findFileByIoFile(pomFile, true);
if (pom == null) {
return Promises.rejectedPromise("Can't find Maven pom.xml file to import into IDEA");
}
manager.addManagedFiles(Collections.singletonList(pom));
return manager.scheduleImportAndResolve().then(modules -> manager.findProject(module));
}
use of org.jetbrains.idea.maven.project.MavenProjectsManager in project azure-tools-for-java by Microsoft.
the class MavenUtils method evaluateEffectivePom.
public static String evaluateEffectivePom(@NotNull Project ideaProject, @NotNull MavenProject mavenProject) throws MavenProcessCanceledException {
final MavenProjectsManager projectsManager = MavenProjectsManager.getInstance(ideaProject);
final MavenEmbeddersManager embeddersManager = projectsManager.getEmbeddersManager();
final MavenExplicitProfiles profiles = mavenProject.getActivatedProfilesIds();
final MavenEmbedderWrapper embedder = embeddersManager.getEmbedder(mavenProject, MavenEmbeddersManager.FOR_DEPENDENCIES_RESOLVE);
embedder.clearCachesFor(mavenProject.getMavenId());
return embedder.evaluateEffectivePom(mavenProject.getFile(), profiles.getEnabledProfiles(), profiles.getDisabledProfiles());
}
use of org.jetbrains.idea.maven.project.MavenProjectsManager in project moe-ide-integration by multi-os-engine.
the class ModuleUtils method isMOEMavenModule.
public static boolean isMOEMavenModule(@NotNull Module module) {
if (!isMavenSupport()) {
return false;
}
String pomXmlPath = findPomXml(module);
if (pomXmlPath == null || pomXmlPath.isEmpty()) {
return false;
}
VirtualFile file = LocalFileSystem.getInstance().findFileByPath(pomXmlPath);
if (file == null)
return false;
MavenProjectsManager manager = MavenProjectsManager.getInstance(module.getProject());
if (manager == null) {
return false;
}
MavenProject mavenProject = manager.findProject(file);
if (mavenProject == null) {
return false;
}
MavenPlugin mavenPlugin = mavenProject.findPlugin("org.multi-os-engine", "moe-maven");
if (mavenPlugin != null) {
return true;
}
return false;
}
Aggregations