Search in sources :

Example 56 with MavenExecutionRequest

use of org.apache.maven.execution.MavenExecutionRequest in project tycho by eclipse.

the class ValidateIdTest method getMojo.

private ValidateIdMojo getMojo(File basedir) throws Exception {
    File pom = new File(basedir, "pom.xml");
    MavenExecutionRequest request = newMavenExecutionRequest(pom);
    request.getProjectBuildingRequest().setProcessPlugins(false);
    MavenExecutionResult result = maven.execute(request);
    MavenProject project = result.getProject();
    ValidateIdMojo mojo = (ValidateIdMojo) lookupMojo("validate-id", project.getFile());
    setVariableValueToObject(mojo, "project", project);
    setVariableValueToObject(mojo, "packaging", project.getPackaging());
    return mojo;
}
Also used : MavenProject(org.apache.maven.project.MavenProject) MavenExecutionResult(org.apache.maven.execution.MavenExecutionResult) MavenExecutionRequest(org.apache.maven.execution.MavenExecutionRequest) File(java.io.File)

Aggregations

MavenExecutionRequest (org.apache.maven.execution.MavenExecutionRequest)56 DefaultMavenExecutionRequest (org.apache.maven.execution.DefaultMavenExecutionRequest)40 File (java.io.File)24 MavenSession (org.apache.maven.execution.MavenSession)20 MavenExecutionResult (org.apache.maven.execution.MavenExecutionResult)14 MavenProject (org.apache.maven.project.MavenProject)14 DefaultMavenExecutionResult (org.apache.maven.execution.DefaultMavenExecutionResult)10 IOException (java.io.IOException)9 MavenExecutionRequestPopulationException (org.apache.maven.execution.MavenExecutionRequestPopulationException)9 MavenExecutionRequestPopulator (org.apache.maven.execution.MavenExecutionRequestPopulator)9 DefaultPlexusContainer (org.codehaus.plexus.DefaultPlexusContainer)8 ProjectBuildingRequest (org.apache.maven.project.ProjectBuildingRequest)7 DefaultRepositorySystemSession (org.eclipse.aether.DefaultRepositorySystemSession)7 FileNotFoundException (java.io.FileNotFoundException)6 Path (java.nio.file.Path)6 Properties (java.util.Properties)6 ArtifactRepository (org.apache.maven.artifact.repository.ArtifactRepository)6 ComponentLookupException (org.codehaus.plexus.component.repository.exception.ComponentLookupException)6 LifecycleExecutionException (org.apache.maven.lifecycle.LifecycleExecutionException)5 ProjectBuilder (org.apache.maven.project.ProjectBuilder)5