use of org.jetbrains.idea.maven.execution.SoutMavenConsole in project intellij-community by JetBrains.
the class MavenServerEmbedderTest method _testDependencyWithUnresolvedParent.
public void _testDependencyWithUnresolvedParent() throws Exception {
File repo = new File(myDir, "/repo");
setRepositoryPath(repo.getPath());
initEmbedder();
VirtualFile m = createModulePom("foo-parent", "<groupId>test</groupId>" + "<artifactId>foo-parent</artifactId>" + "<version>1</version>" + "<packaging>pom</packaging>");
myEmbedder.customizeForResolve(new SoutMavenConsole(), EMPTY_MAVEN_PROCESS);
myEmbedder.execute(m, Collections.<String>emptyList(), Collections.<String>emptyList(), Arrays.asList("install"));
myEmbedder.reset();
File fooParentFile = new File(repo, "test/foo-parent/1/foo-parent-1.pom");
assertTrue(fooParentFile.exists());
m = createModulePom("foo", "<artifactId>foo</artifactId>" + "<version>1</version>" + "<parent>" + " <groupId>test</groupId>" + " <artifactId>foo-parent</artifactId>" + " <version>1</version>" + "</parent>");
myEmbedder.customizeForResolve(new SoutMavenConsole(), EMPTY_MAVEN_PROCESS);
myEmbedder.execute(m, Collections.<String>emptyList(), Collections.<String>emptyList(), Arrays.asList("install"));
myEmbedder.reset();
assertTrue(new File(repo, "test/foo/1/foo-1.pom").exists());
FileUtil.delete(fooParentFile);
// reset all caches
initEmbedder();
createProjectPom("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<dependencies>" + " <dependency>" + " <groupId>test</groupId>" + " <artifactId>foo</artifactId>" + " <version>1</version>" + " </dependency>" + "</dependencies>");
myEmbedder.customizeForResolve(new SoutMavenConsole(), EMPTY_MAVEN_PROCESS);
MavenServerExecutionResult result = myEmbedder.resolveProject(myProjectPom, Collections.<String>emptyList(), Collections.<String>emptyList());
assertNotNull(result.projectData);
assertOrderedElementsAreEqual(result.unresolvedArtifacts, new MavenId("test", "foo-parent", "1"));
}
use of org.jetbrains.idea.maven.execution.SoutMavenConsole in project intellij-community by JetBrains.
the class MavenServerEmbedderTest method _testResolvingProjectWithRegisteredExtensions.
public void _testResolvingProjectWithRegisteredExtensions() throws Exception {
ComponentDescriptor desc = new ComponentDescriptor();
desc.setRole(ArtifactHandler.ROLE);
desc.setRoleHint("foo");
desc.setImplementation(MyArtifactHandler.class.getName());
myEmbedderImpl.getContainer().addComponentDescriptor(desc);
createProjectPom("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<dependencies>" + " <dependency>" + " <groupId>junit</groupId>" + " <artifactId>junit</artifactId>" + " <version>3.8.1</version>" + " <scope>test</scope>" + " <type>foo</type>" + " </dependency>" + "</dependencies>");
myEmbedder.customizeForResolve(new SoutMavenConsole(), EMPTY_MAVEN_PROCESS);
MavenServerExecutionResult result = myEmbedder.resolveProject(myProjectPom, Collections.<String>emptyList(), Collections.<String>emptyList());
assertNotNull(result.projectData);
assertOrderedElementsAreEqual(result.unresolvedArtifacts);
MavenModel p = result.projectData.mavenModel;
assertEquals(1, p.getDependencies().size());
assertEquals("pom", p.getDependencies().get(0).getExtension());
}
use of org.jetbrains.idea.maven.execution.SoutMavenConsole in project intellij-community by JetBrains.
the class MavenServerEmbedderTest method _testResolvingProjectPropertiesInFolders.
public void _testResolvingProjectPropertiesInFolders() throws Exception {
createProjectPom("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>");
myEmbedder.customizeForResolve(new SoutMavenConsole(), EMPTY_MAVEN_PROCESS);
MavenServerExecutionResult result = myEmbedder.resolveProject(myProjectPom, Collections.<String>emptyList(), Collections.<String>emptyList());
MavenModel project = result.projectData.mavenModel;
assertNotNull(project);
assertEquals("project", project.getMavenId().getArtifactId());
PlatformTestUtil.assertPathsEqual(myProjectRoot.getPath() + "/target", project.getBuild().getDirectory());
PlatformTestUtil.assertPathsEqual(myProjectRoot.getPath() + "/src/main/java", project.getBuild().getSources().get(0));
}
use of org.jetbrains.idea.maven.execution.SoutMavenConsole in project intellij-community by JetBrains.
the class MavenServerEmbedderTest method _testUnresolvedSystemArtifacts.
public void _testUnresolvedSystemArtifacts() throws Exception {
createProjectPom("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<dependencies>" + " <dependency>" + " <groupId>fff</groupId>" + " <artifactId>zzz</artifactId>" + " <version>666</version>" + " <scope>system</scope>" + " <systemPath>" + myProjectRoot.getPath() + "/foo.jar</systemPath>" + " </dependency>" + "</dependencies>");
myEmbedder.customizeForResolve(new SoutMavenConsole(), EMPTY_MAVEN_PROCESS);
MavenServerExecutionResult result = myEmbedder.resolveProject(myProjectPom, Collections.<String>emptyList(), Collections.<String>emptyList());
assertNotNull(result.projectData);
assertOrderedElementsAreEqual(result.unresolvedArtifacts, new MavenId("fff", "zzz", "666"));
}
use of org.jetbrains.idea.maven.execution.SoutMavenConsole in project intellij-community by JetBrains.
the class MavenServerEmbedderTest method _testResolvingProject.
public void _testResolvingProject() throws Exception {
createProjectPom("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<dependencies>" + " <dependency>" + " <groupId>junit</groupId>" + " <artifactId>junit</artifactId>" + " <version>4.0</version>" + " </dependency>" + "</dependencies>");
myEmbedder.customizeForResolve(new SoutMavenConsole(), EMPTY_MAVEN_PROCESS);
MavenServerExecutionResult result = myEmbedder.resolveProject(myProjectPom, Collections.<String>emptyList(), Collections.<String>emptyList());
assertNotNull(result.projectData);
assertOrderedElementsAreEqual(result.unresolvedArtifacts);
MavenModel project = result.projectData.mavenModel;
assertNotNull(project);
assertEquals("project", project.getMavenId().getArtifactId());
assertEquals(1, project.getDependencies().size());
}
Aggregations