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");
}
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);
}
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);
}
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();
}
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();
}
Aggregations