use of org.apache.maven.execution.MavenExecutionRequest in project tycho by eclipse.
the class AbstractTychoMojoTestCase method getSortedProjects.
protected List<MavenProject> getSortedProjects(File basedir, Properties userProperties, File platform) throws Exception {
File pom = new File(basedir, "pom.xml");
MavenExecutionRequest request = newMavenExecutionRequest(pom);
request.getProjectBuildingRequest().setProcessPlugins(false);
request.setLocalRepository(getLocalRepository());
if (platform != null) {
request.getUserProperties().put("tycho.targetPlatform", platform.getAbsolutePath());
}
if (userProperties != null) {
request.getUserProperties().putAll(userProperties);
}
MavenExecutionResult result = maven.execute(request);
if (result.hasExceptions()) {
throw new CompoundRuntimeException(result.getExceptions());
}
return result.getTopologicallySortedProjects();
}
use of org.apache.maven.execution.MavenExecutionRequest 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.MavenExecutionRequest in project sts4 by spring-projects.
the class MavenBridge method getMirrors.
public List<Mirror> getMirrors() throws MavenException {
MavenExecutionRequest request = createExecutionRequest();
populateDefaults(request);
return request.getMirrors();
}
use of org.apache.maven.execution.MavenExecutionRequest in project sts4 by spring-projects.
the class MavenBridge method compileAndGenerateJavadoc.
public MavenExecutionResult compileAndGenerateJavadoc(File pom) throws MavenException {
try {
MavenExecutionRequest request = createExecutionRequest();
lookup(MavenExecutionRequestPopulator.class).populateDefaults(request);
request.setPom(pom);
ProjectBuildingRequest configuration = request.getProjectBuildingRequest();
configuration.setValidationLevel(ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL);
configuration.setRepositorySession(createRepositorySession(request));
configuration.setResolveDependencies(true);
configuration.setResolveVersionRanges(true);
request.setGoals(Arrays.asList(new String[] { "compile", "javadoc:javadoc" }));
Properties userProperties = (Properties) request.getUserProperties().clone();
userProperties.put("show", "private");
request.setUserProperties(userProperties);
return lookup(Maven.class).execute(request);
} catch (MavenExecutionRequestPopulationException e) {
throw new MavenException(e);
}
}
use of org.apache.maven.execution.MavenExecutionRequest in project sts4 by spring-projects.
the class MavenBridge method getMirror.
public Mirror getMirror(ArtifactRepository repo) throws MavenException {
MavenExecutionRequest request = createExecutionRequest();
populateDefaults(request);
return lookup(RepositorySystem.class).getMirror(repo, request.getMirrors());
}
Aggregations