Search in sources :

Example 11 with MavenModel

use of org.eclipse.che.maven.data.MavenModel in project che by eclipse.

the class MavenServerTest method testInterpolateModel.

@Test
public void testInterpolateModel() throws Exception {
    MavenModel model = new MavenModel();
    model.setMavenKey(new MavenKey("aaa", "bbb", "ccc"));
    model.getBuild().setSources(Collections.singletonList("src/main/java"));
    model.getBuild().setTestSources(Collections.singletonList("src/test/java"));
    MavenModel interpolateModel = MavenServerImpl.interpolateModel(model, new File(MavenServerTest.class.getResource("/EffectivePom/pom.xml").getFile()));
    Assert.assertNotNull(interpolateModel);
}
Also used : MavenKey(org.eclipse.che.maven.data.MavenKey) MavenModel(org.eclipse.che.maven.data.MavenModel) File(java.io.File) Test(org.testng.annotations.Test)

Example 12 with MavenModel

use of org.eclipse.che.maven.data.MavenModel in project che by eclipse.

the class MavenModelReader method readMavenProject.

public MavenModelReaderResult readMavenProject(File pom, MavenServerManager serverManager) {
    Pair<ModelReadingResult, Pair<List<String>, List<String>>> readResult = readModel(pom);
    MavenModel model = readResult.first.model;
    model = serverManager.interpolateModel(model, pom.getParentFile());
    Pair<List<String>, List<String>> profilesPair = readResult.second;
    return new MavenModelReaderResult(model, profilesPair.first, profilesPair.first, readResult.first.problems, Collections.emptySet());
}
Also used : MavenModel(org.eclipse.che.maven.data.MavenModel) ArrayList(java.util.ArrayList) Collections.singletonList(java.util.Collections.singletonList) Collections.emptyList(java.util.Collections.emptyList) List(java.util.List) Pair(org.eclipse.che.commons.lang.Pair)

Example 13 with MavenModel

use of org.eclipse.che.maven.data.MavenModel in project che by eclipse.

the class MavenServerManagerTest method testResolveMultimoduleProjectMainPom.

@Test
public void testResolveMultimoduleProjectMainPom() throws Exception {
    MavenServerResult resolveProject = mavenServer.resolveProject(new File(MavenServerManagerTest.class.getResource("/multimoduleProject/pom.xml").getFile()), Collections.emptyList(), Collections.emptyList());
    assertNotNull(resolveProject);
    MavenProjectInfo projectInfo = resolveProject.getProjectInfo();
    assertNotNull(projectInfo);
    MavenModel mavenModel = projectInfo.getMavenModel();
    assertNotNull(mavenModel);
    assertThat(mavenModel.getPackaging()).isEqualTo("pom");
    assertThat(mavenModel.getModules()).containsExactly("subModule", "test");
    assertThat(mavenModel.getDependencies()).isEmpty();
}
Also used : MavenServerResult(org.eclipse.che.maven.server.MavenServerResult) MavenModel(org.eclipse.che.maven.data.MavenModel) MavenProjectInfo(org.eclipse.che.maven.server.MavenProjectInfo) File(java.io.File) Test(org.testng.annotations.Test)

Aggregations

MavenModel (org.eclipse.che.maven.data.MavenModel)13 File (java.io.File)7 MavenKey (org.eclipse.che.maven.data.MavenKey)6 Test (org.testng.annotations.Test)6 MavenArtifact (org.eclipse.che.maven.data.MavenArtifact)4 MavenProjectInfo (org.eclipse.che.maven.server.MavenProjectInfo)4 MavenServerResult (org.eclipse.che.maven.server.MavenServerResult)4 ArrayList (java.util.ArrayList)3 HashSet (java.util.HashSet)3 MavenParent (org.eclipse.che.maven.data.MavenParent)3 Properties (java.util.Properties)2 Model (org.apache.maven.model.Model)2 Parent (org.apache.maven.model.Parent)2 MavenBuild (org.eclipse.che.maven.data.MavenBuild)2 MavenProjectProblem (org.eclipse.che.maven.data.MavenProjectProblem)2 IOException (java.io.IOException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 RemoteException (java.rmi.RemoteException)1 Collections.emptyList (java.util.Collections.emptyList)1 Collections.singletonList (java.util.Collections.singletonList)1