Class MojoExecutionStub

java.lang.Object
org.apache.maven.api.plugin.testing.stubs.MojoExecutionStub
All Implemented Interfaces:
org.apache.maven.api.MojoExecution

public class MojoExecutionStub extends Object implements org.apache.maven.api.MojoExecution
A stub implementation of MojoExecution for testing Maven plugins. This class provides a simplified representation of a Mojo execution context, allowing tests to simulate plugin executions without a full Maven environment.

Example usage:

MojoExecutionStub execution = new MojoExecutionStub("myExecution", "myGoal");
execution.setPlugin(new PluginStub());
execution.setDescriptor(mojoDescriptor);
Since:
4.0.0
See Also:
  • Constructor Details

    • MojoExecutionStub

      public MojoExecutionStub(String executionId, String goal)
    • MojoExecutionStub

      public MojoExecutionStub(String executionId, String goal, org.apache.maven.api.xml.XmlNode dom)
  • Method Details

    • getPlugin

      public org.apache.maven.api.Plugin getPlugin()
      Specified by:
      getPlugin in interface org.apache.maven.api.MojoExecution
    • getModel

      public org.apache.maven.api.model.PluginExecution getModel()
      Specified by:
      getModel in interface org.apache.maven.api.MojoExecution
    • getDescriptor

      public org.apache.maven.api.plugin.descriptor.MojoDescriptor getDescriptor()
      Specified by:
      getDescriptor in interface org.apache.maven.api.MojoExecution
    • getLifecyclePhase

      public String getLifecyclePhase()
      Specified by:
      getLifecyclePhase in interface org.apache.maven.api.MojoExecution
    • getExecutionId

      public String getExecutionId()
      Specified by:
      getExecutionId in interface org.apache.maven.api.MojoExecution
    • getGoal

      public String getGoal()
      Specified by:
      getGoal in interface org.apache.maven.api.MojoExecution
    • getConfiguration

      public Optional<org.apache.maven.api.xml.XmlNode> getConfiguration()
      Specified by:
      getConfiguration in interface org.apache.maven.api.MojoExecution
    • setExecutionId

      public void setExecutionId(String executionId)
    • setGoal

      public void setGoal(String goal)
    • setDom

      public void setDom(org.apache.maven.api.xml.XmlNode dom)
    • setPlugin

      public void setPlugin(org.apache.maven.api.Plugin plugin)
    • setModel

      public void setModel(org.apache.maven.api.model.PluginExecution model)
    • setDescriptor

      public void setDescriptor(org.apache.maven.api.plugin.descriptor.MojoDescriptor descriptor)
    • setLifecyclePhase

      public void setLifecyclePhase(String lifecyclePhase)