Package org.openrewrite.maven
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
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.apache.maven.execution.MavenSessionprotected org.apache.maven.project.MavenProjectprotected org.eclipse.aether.RepositorySystemprotected org.apache.maven.rtinfo.RuntimeInformationprotected org.apache.maven.settings.crypto.SettingsDecrypterFields inherited from class org.openrewrite.maven.ConfigurableRewriteMojo
activeRecipes, activeStyles, checkstyleConfigFile, checkstyleDetectionEnabled, configLocation, failOnInvalidActiveRecipes, metricsPassword, metricsUri, metricsUsername, pomCacheDirectory, pomCacheEnabled, rewriteActiveRecipes, rewriteActiveStyles, rewriteSkip, runPerSubmodule, sizeThresholdMb, skipMavenParsingFields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.openrewrite.config.Environmentprotected org.openrewrite.config.Environmentenvironment(@Nullable ClassLoader recipeClassLoader) protected org.openrewrite.ExecutionContextprotected Pathprotected @Nullable URLClassLoaderstatic org.openrewrite.config.RecipeDescriptorgetRecipeDescriptor(String recipe, Collection<org.openrewrite.config.RecipeDescriptor> recipeDescriptors) protected AbstractRewriteMojo.ResultsContainerlistResults(org.openrewrite.ExecutionContext ctx) protected org.openrewrite.LargeSourceSetloadSourceSet(Path repositoryRoot, org.openrewrite.config.Environment env, org.openrewrite.ExecutionContext ctx) protected voidlogRecipesThatMadeChanges(org.openrewrite.Result result) protected PathAttempt to determine the root of the git repository for the given project.protected List<org.openrewrite.Result> runRecipe(org.openrewrite.Recipe recipe, org.openrewrite.LargeSourceSet sourceSet, org.openrewrite.ExecutionContext ctx) Methods inherited from class org.openrewrite.maven.ConfigurableRewriteMojo
getActiveRecipes, getActiveStyles, getExclusions, getPlainTextMasks, getRecipeArtifactCoordinates, loadStylesMethods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContextMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.maven.plugin.Mojo
execute
-
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
-
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.DependencyResolutionRequiredExceptionorg.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
-