Search in sources :

Example 11 with MavenExplicitProfiles

use of org.jetbrains.idea.maven.model.MavenExplicitProfiles in project intellij-community by JetBrains.

the class ResourceFilteringTest method testUpdatingWhenProfilesAreChanged.

public void testUpdatingWhenProfilesAreChanged() throws Exception {
    createProjectSubFile("resources/file.properties", "value=${foo}");
    createProjectPom("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<profiles>" + "  <profile>" + "    <id>one</id>" + "    <properties>" + "      <foo>val1</foo>" + "    </properties>" + "  </profile>" + "  <profile>" + "    <id>two</id>" + "    <properties>" + "      <foo>val2</foo>" + "    </properties>" + "  </profile>" + "</profiles>" + "<build>" + "  <resources>" + "    <resource>" + "      <directory>resources</directory>" + "      <filtering>true</filtering>" + "    </resource>" + "  </resources>" + "</build>");
    importProjectWithProfiles("one");
    compileModules("project");
    assertResult("target/classes/file.properties", "value=val1");
    myProjectsManager.setExplicitProfiles(new MavenExplicitProfiles(Arrays.asList("two")));
    scheduleResolveAll();
    resolveDependenciesAndImport();
    compileModules("project");
    assertResult("target/classes/file.properties", "value=val2");
}
Also used : MavenExplicitProfiles(org.jetbrains.idea.maven.model.MavenExplicitProfiles)

Example 12 with MavenExplicitProfiles

use of org.jetbrains.idea.maven.model.MavenExplicitProfiles in project intellij-community by JetBrains.

the class SelectProfilesStep method validate.

public boolean validate() throws ConfigurationException {
    Collection<String> activatedProfiles = myMarkStateDescriptor.getActivatedProfiles();
    MavenExplicitProfiles newSelectedProfiles = MavenExplicitProfiles.NONE.clone();
    for (Map.Entry<String, MavenProfileKind> entry : profileChooser.getElementMarkStates().entrySet()) {
        String profile = entry.getKey();
        MavenProfileKind profileKind = entry.getValue();
        switch(profileKind) {
            case NONE:
                if (activatedProfiles.contains(profile)) {
                    newSelectedProfiles.getDisabledProfiles().add(profile);
                }
                break;
            case EXPLICIT:
                newSelectedProfiles.getEnabledProfiles().add(profile);
                break;
            case IMPLICIT:
                break;
        }
    }
    return getBuilder().setSelectedProfiles(newSelectedProfiles);
}
Also used : MavenProfileKind(org.jetbrains.idea.maven.model.MavenProfileKind) MavenExplicitProfiles(org.jetbrains.idea.maven.model.MavenExplicitProfiles)

Example 13 with MavenExplicitProfiles

use of org.jetbrains.idea.maven.model.MavenExplicitProfiles in project intellij-community by JetBrains.

the class SelectProfilesStep method updateStep.

public void updateStep() {
    List<String> allProfiles = getBuilder().getProfiles();
    List<String> activatedProfiles = getBuilder().getActivatedProfiles();
    MavenExplicitProfiles selectedProfiles = getBuilder().getSelectedProfiles();
    List<String> enabledProfiles = new ArrayList<>(selectedProfiles.getEnabledProfiles());
    List<String> disabledProfiles = new ArrayList<>(selectedProfiles.getDisabledProfiles());
    // mark only existing profiles
    enabledProfiles.retainAll(allProfiles);
    // mark only existing profiles
    disabledProfiles.retainAll(allProfiles);
    myMarkStateDescriptor.setActivatedProfiles(activatedProfiles);
    profileChooser.setElements(allProfiles, null);
    profileChooser.markElements(enabledProfiles, MavenProfileKind.EXPLICIT);
    profileChooser.markElements(disabledProfiles, MavenProfileKind.NONE);
}
Also used : MavenExplicitProfiles(org.jetbrains.idea.maven.model.MavenExplicitProfiles)

Example 14 with MavenExplicitProfiles

use of org.jetbrains.idea.maven.model.MavenExplicitProfiles in project intellij-community by JetBrains.

the class MavenImportingTestCase method readProjects.

protected void readProjects(List<VirtualFile> files, String... profiles) {
    myProjectsManager.resetManagedFilesAndProfilesInTests(files, new MavenExplicitProfiles(Arrays.asList(profiles)));
    waitForReadingCompletion();
}
Also used : MavenExplicitProfiles(org.jetbrains.idea.maven.model.MavenExplicitProfiles)

Example 15 with MavenExplicitProfiles

use of org.jetbrains.idea.maven.model.MavenExplicitProfiles in project intellij-community by JetBrains.

the class MavenPropertyCompletionAndResolutionTest method readWithProfiles.

private void readWithProfiles(String... profiles) {
    myProjectsManager.setExplicitProfiles(new MavenExplicitProfiles(Arrays.asList(profiles)));
    waitForReadingCompletion();
}
Also used : MavenExplicitProfiles(org.jetbrains.idea.maven.model.MavenExplicitProfiles)

Aggregations

MavenExplicitProfiles (org.jetbrains.idea.maven.model.MavenExplicitProfiles)20 MavenRunnerParameters (org.jetbrains.idea.maven.execution.MavenRunnerParameters)5 VirtualFile (com.intellij.openapi.vfs.VirtualFile)4 MavenProjectsManager (org.jetbrains.idea.maven.project.MavenProjectsManager)4 Project (com.intellij.openapi.project.Project)3 MavenProfileKind (org.jetbrains.idea.maven.model.MavenProfileKind)3 MavenProject (org.jetbrains.idea.maven.project.MavenProject)3 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)2 Semaphore (com.intellij.util.concurrency.Semaphore)2 NotNull (org.jetbrains.annotations.NotNull)2 MavenEmbedderWrapper (org.jetbrains.idea.maven.server.MavenEmbedderWrapper)2 IdeModifiableModelsProviderImpl (com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProviderImpl)1 IdeUIModifiableModelsProvider (com.intellij.openapi.externalSystem.service.project.IdeUIModifiableModelsProvider)1 ConfigurationException (com.intellij.openapi.options.ConfigurationException)1 Task (com.intellij.openapi.progress.Task)1 IgnoredFileBean (com.intellij.openapi.vcs.changes.IgnoredFileBean)1 PsiFile (com.intellij.psi.PsiFile)1 IOException (java.io.IOException)1 Map (java.util.Map)1 Nullable (org.jetbrains.annotations.Nullable)1