use of org.jetbrains.idea.maven.project.MavenProject in project intellij-community by JetBrains.
the class MavenProjectsTreeReadingTest method testUpdatingModelWhenParentProfilesXmlChangeAndItIsAModuleAlso.
public void testUpdatingModelWhenParentProfilesXmlChangeAndItIsAModuleAlso() throws Exception {
createProjectPom("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<packaging>pom</packaging>" + "<modules>" + " <module>m</module>" + "</modules>");
createProfilesXmlOldStyle("<profile>" + " <id>one</id>" + " <activation>" + " <activeByDefault>true</activeByDefault>" + " </activation>" + " <properties>" + " <prop>value1</prop>" + " </properties>" + "</profile>");
createModulePom("m", "<groupId>test</groupId>" + "<artifactId>m</artifactId>" + "<version>1</version>" + "<parent>" + " <groupId>test</groupId>" + " <artifactId>project</artifactId>" + " <version>1</version>" + "</parent>" + "<build>" + " <sourceDirectory>${prop}</sourceDirectory>" + "</build>");
updateAll(myProjectPom);
MavenProject childNode = myTree.getModules(myTree.getRootProjects().get(0)).get(0);
assertUnorderedPathsAreEqual(childNode.getSources(), Arrays.asList(FileUtil.toSystemDependentName(getProjectPath() + "/m/value1")));
createProfilesXmlOldStyle("<profile>" + " <id>one</id>" + " <activation>" + " <activeByDefault>true</activeByDefault>" + " </activation>" + " <properties>" + " <prop>value2</prop>" + " </properties>" + "</profile>");
updateAll(myProjectPom);
assertUnorderedPathsAreEqual(childNode.getSources(), Arrays.asList(FileUtil.toSystemDependentName(getProjectPath() + "/m/value2")));
}
use of org.jetbrains.idea.maven.project.MavenProject in project intellij-community by JetBrains.
the class MavenProjectsTreeReadingTest method testUpdatingParticularProject.
public void testUpdatingParticularProject() throws Exception {
createProjectPom("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<packaging>pom</packaging>" + "<modules>" + " <module>m</module>" + "</modules>");
VirtualFile m = createModulePom("m", "<groupId>test</groupId>" + "<artifactId>m</artifactId>" + "<version>1</version>");
updateAll(myProjectPom);
createModulePom("m", "<groupId>test</groupId>" + "<artifactId>m1</artifactId>" + "<version>1</version>");
update(m);
MavenProject n = myTree.findProject(m);
assertEquals("m1", n.getMavenId().getArtifactId());
}
use of org.jetbrains.idea.maven.project.MavenProject in project intellij-community by JetBrains.
the class MavenProjectsTreeReadingTest method testDoNotUpdateChildAfterParentWasResolved.
public void testDoNotUpdateChildAfterParentWasResolved() throws Exception {
createProjectPom("<groupId>test</groupId>" + "<artifactId>parent</artifactId>" + "<version>1</version>");
VirtualFile child = createModulePom("child", "<groupId>test</groupId>" + "<artifactId>child</artifactId>" + "<version>1</version>" + "<parent>" + " <groupId>test</groupId>" + " <artifactId>parent</artifactId>" + " <version>1</version>" + "</parent>");
MyLoggingListener listener = new MyLoggingListener();
myTree.addListener(listener);
updateAll(myProjectPom, child);
MavenProject parentProject = myTree.findProject(myProjectPom);
MavenEmbeddersManager embeddersManager = new MavenEmbeddersManager(myProject);
try {
final NativeMavenProjectHolder[] nativeProject = new NativeMavenProjectHolder[1];
myTree.addListener(new MavenProjectsTree.Listener() {
@Override
public void projectResolved(Pair<MavenProject, MavenProjectChanges> projectWithChanges, NativeMavenProjectHolder nativeMavenProject) {
nativeProject[0] = nativeMavenProject;
}
});
myTree.resolve(myProject, parentProject, getMavenGeneralSettings(), embeddersManager, NULL_MAVEN_CONSOLE, EMPTY_MAVEN_PROCESS);
myTree.resolvePlugins(parentProject, nativeProject[0], embeddersManager, NULL_MAVEN_CONSOLE, EMPTY_MAVEN_PROCESS);
myTree.resolveFolders(parentProject, getMavenImporterSettings(), embeddersManager, NULL_MAVEN_CONSOLE, EMPTY_MAVEN_PROCESS);
} finally {
embeddersManager.releaseInTests();
}
assertEquals("updated: parent child deleted: <none> resolved: parent plugins: parent folders: parent ", listener.log);
myTree.updateAll(false, getMavenGeneralSettings(), EMPTY_MAVEN_PROCESS);
assertEquals("updated: parent child deleted: <none> resolved: parent plugins: parent folders: parent ", listener.log);
}
use of org.jetbrains.idea.maven.project.MavenProject in project intellij-community by JetBrains.
the class MavenProjectsTreeReadingTest method testReconnectModuleOfDeletedProjectIfModuleIsManaged.
public void testReconnectModuleOfDeletedProjectIfModuleIsManaged() throws Exception {
createProjectPom("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<packaging>pom</packaging>" + "<modules>" + " <module>m1</module>" + "</modules>");
VirtualFile m1 = createModulePom("m1", "<groupId>test</groupId>" + "<artifactId>m1</artifactId>" + "<version>1</version>" + "<packaging>pom</packaging>" + "<modules>" + " <module>m2</module>" + "</modules>");
VirtualFile m2 = createModulePom("m1/m2", "<groupId>test</groupId>" + "<artifactId>m2</artifactId>" + "<version>1</version>");
updateAll(myProjectPom, m2);
List<MavenProject> roots = myTree.getRootProjects();
assertEquals(1, roots.size());
assertEquals(1, myTree.getModules(roots.get(0)).size());
assertEquals(1, myTree.getModules(myTree.getModules(roots.get(0)).get(0)).size());
MyLoggingListener listener = new MyLoggingListener();
myTree.addListener(listener);
deleteProject(m1);
roots = myTree.getRootProjects();
assertEquals(2, roots.size());
assertEquals(myProjectPom, roots.get(0).getFile());
assertEquals(0, myTree.getModules(roots.get(0)).size());
assertEquals(m2, roots.get(1).getFile());
assertEquals(0, myTree.getModules(roots.get(1)).size());
assertEquals("updated: m2 deleted: m1 ", listener.log);
}
use of org.jetbrains.idea.maven.project.MavenProject in project intellij-community by JetBrains.
the class DependenciesImportingTest method testInterModuleDependenciesWithReleaseVersion.
public void testInterModuleDependenciesWithReleaseVersion() throws Exception {
createProjectPom("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<packaging>pom</packaging>" + "<version>1</version>" + "<modules>" + " <module>m1</module>" + " <module>m2</module>" + "</modules>");
createModulePom("m1", "<groupId>test</groupId>" + "<artifactId>m1</artifactId>" + "<version>1</version>" + "<dependencies>" + " <dependency>" + " <groupId>test</groupId>" + " <artifactId>m2</artifactId>" + " <version>RELEASE</version>" + " </dependency>" + "</dependencies>");
createModulePom("m2", "<groupId>test</groupId>" + "<artifactId>m2</artifactId>" + "<version>1</version>");
importProject();
assertModules("project", "m1", "m2");
assertModuleModuleDeps("m1", "m2");
assertModuleLibDeps("m1");
MavenProject p = myProjectsTree.findProject(new MavenId("test", "m1", "1"));
assertEquals(new MavenId("test", "m2", "1"), p.getDependencies().get(0).getMavenId());
}
Aggregations