use of org.jetbrains.idea.maven.model.MavenExplicitProfiles in project intellij-community by JetBrains.
the class MavenProjectsManagerTest method testSavingAndLoadingState.
public void testSavingAndLoadingState() throws Exception {
MavenProjectsManagerState state = myProjectsManager.getState();
assertTrue(state.originalFiles.isEmpty());
assertTrue(MavenWorkspaceSettingsComponent.getInstance(myProject).getSettings().enabledProfiles.isEmpty());
assertTrue(state.ignoredFiles.isEmpty());
assertTrue(state.ignoredPathMasks.isEmpty());
VirtualFile p1 = createModulePom("project1", "<groupId>test</groupId>" + "<artifactId>project1</artifactId>" + "<version>1</version>");
VirtualFile p2 = createModulePom("project2", "<groupId>test</groupId>" + "<artifactId>project2</artifactId>" + "<version>1</version>" + "<packaging>pom</packaging>" + "<modules>" + " <module>../project3</module>" + "</modules>");
VirtualFile p3 = createModulePom("project3", "<groupId>test</groupId>" + "<artifactId>project3</artifactId>" + "<version>1</version>");
importProjects(p1, p2);
myProjectsManager.setExplicitProfiles(new MavenExplicitProfiles(Arrays.asList("one", "two")));
myProjectsManager.setIgnoredFilesPaths(Arrays.asList(p1.getPath()));
myProjectsManager.setIgnoredFilesPatterns(Arrays.asList("*.xxx"));
state = myProjectsManager.getState();
assertUnorderedPathsAreEqual(state.originalFiles, Arrays.asList(p1.getPath(), p2.getPath()));
assertUnorderedElementsAreEqual(MavenWorkspaceSettingsComponent.getInstance(myProject).getState().enabledProfiles, "one", "two");
assertUnorderedPathsAreEqual(state.ignoredFiles, Arrays.asList(p1.getPath()));
assertUnorderedElementsAreEqual(state.ignoredPathMasks, "*.xxx");
MavenProjectsManagerState newState = new MavenProjectsManagerState();
newState.originalFiles = Arrays.asList(p1.getPath(), p3.getPath());
MavenWorkspaceSettingsComponent.getInstance(myProject).getSettings().setEnabledProfiles(Arrays.asList("three"));
newState.ignoredFiles = Collections.singleton(p1.getPath());
newState.ignoredPathMasks = Arrays.asList("*.zzz");
myProjectsManager.loadState(newState);
assertUnorderedPathsAreEqual(myProjectsManager.getProjectsTreeForTests().getManagedFilesPaths(), Arrays.asList(p1.getPath(), p3.getPath()));
assertUnorderedElementsAreEqual(myProjectsManager.getExplicitProfiles().getEnabledProfiles(), "three");
assertUnorderedPathsAreEqual(myProjectsManager.getIgnoredFilesPaths(), Arrays.asList(p1.getPath()));
assertUnorderedElementsAreEqual(myProjectsManager.getIgnoredFilesPatterns(), "*.zzz");
waitForReadingCompletion();
assertUnorderedElementsAreEqual(myProjectsManager.getProjectsTreeForTests().getRootProjectsFiles(), p1, p3);
}
use of org.jetbrains.idea.maven.model.MavenExplicitProfiles in project intellij-community by JetBrains.
the class MavenConfigurationProducer method createBuildParameters.
private static MavenRunnerParameters createBuildParameters(Location l) {
if (!(l instanceof MavenGoalLocation))
return null;
VirtualFile f = ((PsiFile) l.getPsiElement()).getVirtualFile();
List<String> goals = ((MavenGoalLocation) l).getGoals();
MavenExplicitProfiles profiles = MavenProjectsManager.getInstance(l.getProject()).getExplicitProfiles();
return new MavenRunnerParameters(true, f.getParent().getPath(), goals, profiles.getEnabledProfiles(), profiles.getDisabledProfiles());
}
use of org.jetbrains.idea.maven.model.MavenExplicitProfiles in project intellij-community by JetBrains.
the class MavenProjectsTreeTestCase method updateAll.
protected void updateAll(List<String> profiles, VirtualFile... files) throws MavenProcessCanceledException {
myTree.resetManagedFilesAndProfiles(asList(files), new MavenExplicitProfiles(profiles));
myTree.updateAll(false, getMavenGeneralSettings(), EMPTY_MAVEN_PROCESS);
}
use of org.jetbrains.idea.maven.model.MavenExplicitProfiles in project kotlin by JetBrains.
the class MavenImportingTestCase method readProjects.
protected void readProjects(List<VirtualFile> files, String... profiles) {
myProjectsManager.resetManagedFilesAndProfilesInTests(files, new MavenExplicitProfiles(Arrays.asList(profiles)));
waitForReadingCompletion();
}
use of org.jetbrains.idea.maven.model.MavenExplicitProfiles 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());
}
Aggregations