use of org.jetbrains.idea.maven.importing.MavenRootModelAdapter in project intellij-community by JetBrains.
the class MavenFoldersImporterTest method testDoNotUpdateOutputFoldersWhenUpdatingExcludedFolders.
public void testDoNotUpdateOutputFoldersWhenUpdatingExcludedFolders() throws Exception {
importProject("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>");
ApplicationManager.getApplication().runWriteAction(() -> {
MavenRootModelAdapter adapter = new MavenRootModelAdapter(myProjectsTree.findProject(myProjectPom), getModule("project"), new IdeModifiableModelsProviderImpl(myProject));
adapter.useModuleOutput(new File(myProjectRoot.getPath(), "target/my-classes").getPath(), new File(myProjectRoot.getPath(), "target/my-test-classes").getPath());
adapter.getRootModel().commit();
});
MavenFoldersImporter.updateProjectFolders(myProject, true);
ModuleRootManager rootManager = ModuleRootManager.getInstance(getModule("project"));
CompilerModuleExtension compiler = rootManager.getModuleExtension(CompilerModuleExtension.class);
assertTrue(compiler.getCompilerOutputUrl(), compiler.getCompilerOutputUrl().endsWith("my-classes"));
assertTrue(compiler.getCompilerOutputUrlForTests(), compiler.getCompilerOutputUrlForTests().endsWith("my-test-classes"));
}
use of org.jetbrains.idea.maven.importing.MavenRootModelAdapter in project intellij-community by JetBrains.
the class MavenFoldersImporterTest method testDoesNotExcludeRegisteredSources.
public void testDoesNotExcludeRegisteredSources() throws Exception {
importProject("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>");
new File(myProjectRoot.getPath(), "target/foo").mkdirs();
final File sourceDir = new File(myProjectRoot.getPath(), "target/src");
sourceDir.mkdirs();
ApplicationManager.getApplication().runWriteAction(() -> {
MavenRootModelAdapter adapter = new MavenRootModelAdapter(myProjectsTree.findProject(myProjectPom), getModule("project"), new IdeModifiableModelsProviderImpl(myProject));
adapter.addSourceFolder(sourceDir.getPath(), JavaSourceRootType.SOURCE);
adapter.getRootModel().commit();
});
updateProjectFolders();
assertSources("project", "target/src");
assertExcludes("project", "target");
}
Aggregations