Class AbstractRewriteMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.openrewrite.maven.ConfigurableRewriteMojo
org.openrewrite.maven.AbstractRewriteMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
AbstractRewriteDryRunMojo, AbstractRewriteRunMojo, CycloneDxBomMojo, RewriteDiscoverMojo

public abstract class AbstractRewriteMojo extends ConfigurableRewriteMojo
  • Field Details

    • project

      @Parameter(defaultValue="${project}", readonly=true, required=true) protected org.apache.maven.project.MavenProject project
    • runtime

      @Component protected org.apache.maven.rtinfo.RuntimeInformation runtime
    • settingsDecrypter

      @Component protected org.apache.maven.settings.crypto.SettingsDecrypter settingsDecrypter
    • repositorySystem

      @Component protected org.eclipse.aether.RepositorySystem repositorySystem
    • mavenSession

      @Parameter(defaultValue="${session}", readonly=true) protected org.apache.maven.execution.MavenSession mavenSession
  • Constructor Details

    • AbstractRewriteMojo

      public AbstractRewriteMojo()
  • Method Details

    • environment

      protected org.openrewrite.config.Environment environment() throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • environment

      protected org.openrewrite.config.Environment environment(@Nullable @Nullable ClassLoader recipeClassLoader) throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • executionContext

      protected org.openrewrite.ExecutionContext executionContext()
    • getBuildRoot

      protected Path getBuildRoot()
    • repositoryRoot

      protected Path repositoryRoot()
      Attempt to determine the root of the git repository for the given project. Many Gradle builds co-locate the build root with the git repository root, but that is not required. If no git repository can be located in any folder containing the build, the build root will be returned.
    • listResults

      protected AbstractRewriteMojo.ResultsContainer listResults(org.openrewrite.ExecutionContext ctx) throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • loadSourceSet

      protected org.openrewrite.LargeSourceSet loadSourceSet(Path repositoryRoot, org.openrewrite.config.Environment env, org.openrewrite.ExecutionContext ctx) throws org.apache.maven.artifact.DependencyResolutionRequiredException, org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.artifact.DependencyResolutionRequiredException
      org.apache.maven.plugin.MojoExecutionException
    • runRecipe

      protected List<org.openrewrite.Result> runRecipe(org.openrewrite.Recipe recipe, org.openrewrite.LargeSourceSet sourceSet, org.openrewrite.ExecutionContext ctx)
    • getRecipeArtifactCoordinatesClassloader

      @Nullable protected @Nullable URLClassLoader getRecipeArtifactCoordinatesClassloader() throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • logRecipesThatMadeChanges

      protected void logRecipesThatMadeChanges(org.openrewrite.Result result)
    • getRecipeDescriptor

      public static org.openrewrite.config.RecipeDescriptor getRecipeDescriptor(String recipe, Collection<org.openrewrite.config.RecipeDescriptor> recipeDescriptors) throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException