use of org.eclipse.che.maven.data.MavenKey in project che by eclipse.
the class MavenServerImpl method createResult.
private MavenServerResult createResult(File pom, MavenResult mavenResult) throws RemoteException {
List<MavenProjectProblem> problems = new ArrayList<>();
Set<MavenKey> unresolvedArtifacts = new HashSet<>();
validate(pom, mavenResult.getExceptions(), problems);
MavenProject project = mavenResult.getMavenProject();
if (project == null) {
return new MavenServerResult(null, problems, unresolvedArtifacts);
}
MavenModel model = null;
try {
DependencyResolutionResult resolutionResult = mavenResult.getDependencyResolutionResult();
org.eclipse.aether.graph.DependencyNode dependencyNode = null;
if (resolutionResult != null) {
dependencyNode = resolutionResult.getDependencyGraph();
}
List<org.eclipse.aether.graph.DependencyNode> dependencyNodes = null;
if (dependencyNode != null) {
dependencyNodes = dependencyNode.getChildren();
}
model = MavenModelUtil.convertProjectToModel(project, dependencyNodes, new File(localRepo.getBasedir()));
} catch (Exception e) {
validate(project.getFile(), Collections.singletonList(e), problems);
}
List<String> activeProfiles = getActiveProfiles(project);
MavenProjectInfo projectInfo = new MavenProjectInfo(model, null, activeProfiles);
return new MavenServerResult(projectInfo, problems, unresolvedArtifacts);
}
use of org.eclipse.che.maven.data.MavenKey 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);
}
Aggregations