Search in sources :

Example 31 with MojoExecution

use of org.apache.maven.plugin.MojoExecution in project maven-plugins by apache.

the class JavadocReportTest method lookupMojo.

private JavadocReport lookupMojo(File testPom) throws Exception {
    JavadocReport mojo = (JavadocReport) lookupMojo("javadoc", testPom);
    MojoExecution mojoExec = new MojoExecution(new Plugin(), "javadoc", null);
    setVariableValueToObject(mojo, "mojo", mojoExec);
    MavenProject currentProject = new MavenProjectStub();
    currentProject.setGroupId("GROUPID");
    currentProject.setArtifactId("ARTIFACTID");
    setVariableValueToObject(mojo, "session", newMavenSession(currentProject));
    return mojo;
}
Also used : MavenProject(org.apache.maven.project.MavenProject) MavenProjectStub(org.apache.maven.plugin.testing.stubs.MavenProjectStub) MojoExecution(org.apache.maven.plugin.MojoExecution) Plugin(org.apache.maven.model.Plugin)

Example 32 with MojoExecution

use of org.apache.maven.plugin.MojoExecution in project maven-plugins by apache.

the class CompilerMojoTestCase method getMockMojoExecution.

private MojoExecution getMockMojoExecution() {
    MojoDescriptor md = new MojoDescriptor();
    md.setGoal("compile");
    MojoExecution me = new MojoExecution(md);
    PluginDescriptor pd = new PluginDescriptor();
    pd.setArtifactId("maven-compiler-plugin");
    md.setPluginDescriptor(pd);
    return me;
}
Also used : PluginDescriptor(org.apache.maven.plugin.descriptor.PluginDescriptor) MojoDescriptor(org.apache.maven.plugin.descriptor.MojoDescriptor) MojoExecution(org.apache.maven.plugin.MojoExecution)

Example 33 with MojoExecution

use of org.apache.maven.plugin.MojoExecution in project maven-plugins by apache.

the class AggregatorJavadocReportTest method lookupMojo.

private JavadocReport lookupMojo(File testPom) throws Exception {
    JavadocReport mojo = (JavadocReport) lookupMojo("aggregate", testPom);
    MojoExecution mojoExec = new MojoExecution(new Plugin(), "aggregate", null);
    setVariableValueToObject(mojo, "mojo", mojoExec);
    MavenProject currentProject = new MavenProjectStub();
    currentProject.setGroupId("GROUPID");
    currentProject.setArtifactId("ARTIFACTID");
    MavenSession session = newMavenSession(currentProject);
    DefaultRepositorySystemSession repoSysSession = (DefaultRepositorySystemSession) session.getRepositorySession();
    repoSysSession.setLocalRepositoryManager(new SimpleLocalRepositoryManager(localRepo));
    setVariableValueToObject(mojo, "session", session);
    return mojo;
}
Also used : MavenSession(org.apache.maven.execution.MavenSession) SimpleLocalRepositoryManager(org.sonatype.aether.impl.internal.SimpleLocalRepositoryManager) MavenProject(org.apache.maven.project.MavenProject) MavenProjectStub(org.apache.maven.plugin.testing.stubs.MavenProjectStub) DefaultRepositorySystemSession(org.sonatype.aether.util.DefaultRepositorySystemSession) MojoExecution(org.apache.maven.plugin.MojoExecution) Plugin(org.apache.maven.model.Plugin)

Aggregations

MojoExecution (org.apache.maven.plugin.MojoExecution)33 MavenProject (org.apache.maven.project.MavenProject)22 MavenSession (org.apache.maven.execution.MavenSession)13 Test (org.junit.Test)10 File (java.io.File)9 ArrayList (java.util.ArrayList)9 List (java.util.List)7 Xpp3Dom (org.codehaus.plexus.util.xml.Xpp3Dom)7 MavenExecutionPlan (org.apache.maven.lifecycle.MavenExecutionPlan)6 Plugin (org.apache.maven.model.Plugin)6 MojoDescriptor (org.apache.maven.plugin.descriptor.MojoDescriptor)5 SubMonitor (org.eclipse.core.runtime.SubMonitor)5 IMaven (org.eclipse.m2e.core.embedder.IMaven)5 ResolverConfiguration (org.eclipse.m2e.core.project.ResolverConfiguration)5 Path (java.nio.file.Path)4 MavenProjectStub (org.apache.maven.plugin.testing.stubs.MavenProjectStub)4 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)4 IStatus (org.eclipse.core.runtime.IStatus)4 IMavenExecutionContext (org.eclipse.m2e.core.embedder.IMavenExecutionContext)4 Set (java.util.Set)3