use of org.apache.maven.execution.DefaultMavenExecutionResult in project tycho by eclipse.
the class AbstractTychoMojoTestCase method newMavenSession.
protected MavenSession newMavenSession(MavenProject project, List<MavenProject> projects) throws Exception {
MavenExecutionRequest request = newMavenExecutionRequest(new File(project.getBasedir(), "pom.xml"));
MavenExecutionResult result = new DefaultMavenExecutionResult();
DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession();
MavenSession session = new MavenSession(getContainer(), repositorySession, request, result);
session.setProjects(projects);
session.setCurrentProject(project);
return session;
}
use of org.apache.maven.execution.DefaultMavenExecutionResult in project sts4 by spring-projects.
the class MavenBridge method readMavenProject.
public MavenExecutionResult readMavenProject(File pomFile, ProjectBuildingRequest configuration) throws MavenException {
long start = System.currentTimeMillis();
// $NON-NLS-1$
log.debug("Reading Maven project: {}", pomFile.getAbsoluteFile());
MavenExecutionResult result = new DefaultMavenExecutionResult();
try {
configuration.setValidationLevel(ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL);
ProjectBuildingResult projectBuildingResult = lookup(ProjectBuilder.class).build(pomFile, configuration);
result.setProject(projectBuildingResult.getProject());
result.setDependencyResolutionResult(projectBuildingResult.getDependencyResolutionResult());
} catch (ProjectBuildingException ex) {
if (ex.getResults() != null && ex.getResults().size() == 1) {
ProjectBuildingResult projectBuildingResult = ex.getResults().get(0);
result.setProject(projectBuildingResult.getProject());
result.setDependencyResolutionResult(projectBuildingResult.getDependencyResolutionResult());
}
result.addException(ex);
} catch (RuntimeException e) {
result.addException(e);
} finally {
// $NON-NLS-1$
log.debug("Read Maven project: {} in {} ms", pomFile.getAbsoluteFile(), System.currentTimeMillis() - start);
}
return result;
}
use of org.apache.maven.execution.DefaultMavenExecutionResult in project sts4 by spring-projects.
the class MavenBridge method createSession.
@SuppressWarnings("deprecation")
public MavenSession createSession(MavenExecutionRequest request, MavenProject project) throws MavenException {
RepositorySystemSession repoSession = createRepositorySession(request);
MavenExecutionResult result = new DefaultMavenExecutionResult();
MavenSession mavenSession = new MavenSession(plexus, repoSession, request, result);
if (project != null) {
mavenSession.setProjects(Collections.singletonList(project));
}
return mavenSession;
}
use of org.apache.maven.execution.DefaultMavenExecutionResult in project maven-plugins by apache.
the class DefaultDependencyResolverTest method newMavenSession.
protected MavenSession newMavenSession(MavenProject project) {
MavenExecutionRequest request = new DefaultMavenExecutionRequest();
MavenExecutionResult result = new DefaultMavenExecutionResult();
MavenRepositorySystemSession repoSession = new MavenRepositorySystemSession();
repoSession.setLocalRepositoryManager(LegacyLocalRepositoryManager.wrap(new StubArtifactRepository("target/local-repo"), null));
MavenSession session = new MavenSession(getContainer(), repoSession, request, result);
session.setCurrentProject(project);
session.setProjects(Arrays.asList(project));
return session;
}
Aggregations