|
| 1 | +--- |
| 2 | +sidebar_label: "Remove Maven wrapper" |
| 3 | +--- |
| 4 | + |
| 5 | +import Tabs from '@theme/Tabs'; |
| 6 | +import TabItem from '@theme/TabItem'; |
| 7 | + |
| 8 | +# Remove Maven wrapper |
| 9 | + |
| 10 | +**org.openrewrite.maven.RemoveMavenWrapper** |
| 11 | + |
| 12 | +_Remove Maven wrapper files from a project. This includes the `mvnw` and `mvnw.cmd` scripts, and the `.mvn/wrapper` directory._ |
| 13 | + |
| 14 | +## Recipe source |
| 15 | + |
| 16 | +[GitHub: maven.yml](https://github.com/openrewrite/rewrite/blob/main/rewrite-maven/src/main/resources/META-INF/rewrite/maven.yml), |
| 17 | +[Issue Tracker](https://github.com/openrewrite/rewrite/issues), |
| 18 | +[Maven Central](https://central.sonatype.com/artifact/org.openrewrite/rewrite-maven/) |
| 19 | + |
| 20 | +:::info |
| 21 | +This recipe is composed of more than one recipe. If you want to customize the set of recipes this is composed of, you can find and copy the GitHub source for the recipe from the link above. |
| 22 | +::: |
| 23 | + |
| 24 | +This recipe is available under the [Apache License Version 2.0](https://www.apache.org/licenses/LICENSE-2.0). |
| 25 | + |
| 26 | + |
| 27 | +## Definition |
| 28 | + |
| 29 | +<Tabs groupId="recipeType"> |
| 30 | +<TabItem value="recipe-list" label="Recipe List" > |
| 31 | +* [Delete files](../core/deletesourcefiles) |
| 32 | + * filePattern: `**/mvnw` |
| 33 | +* [Delete files](../core/deletesourcefiles) |
| 34 | + * filePattern: `**/mvnw.cmd` |
| 35 | +* [Delete files](../core/deletesourcefiles) |
| 36 | + * filePattern: `**/.mvn/wrapper/**` |
| 37 | + |
| 38 | +</TabItem> |
| 39 | + |
| 40 | +<TabItem value="yaml-recipe-list" label="Yaml Recipe List"> |
| 41 | + |
| 42 | +```yaml |
| 43 | +--- |
| 44 | +type: specs.openrewrite.org/v1beta/recipe |
| 45 | +name: org.openrewrite.maven.RemoveMavenWrapper |
| 46 | +displayName: Remove Maven wrapper |
| 47 | +description: | |
| 48 | + Remove Maven wrapper files from a project. This includes the `mvnw` and `mvnw.cmd` scripts, and the `.mvn/wrapper` directory. |
| 49 | +recipeList: |
| 50 | + - org.openrewrite.DeleteSourceFiles: |
| 51 | + filePattern: **/mvnw |
| 52 | + - org.openrewrite.DeleteSourceFiles: |
| 53 | + filePattern: **/mvnw.cmd |
| 54 | + - org.openrewrite.DeleteSourceFiles: |
| 55 | + filePattern: **/.mvn/wrapper/** |
| 56 | + |
| 57 | +``` |
| 58 | +</TabItem> |
| 59 | +</Tabs> |
| 60 | + |
| 61 | +## Usage |
| 62 | + |
| 63 | +This recipe has no required configuration parameters and comes from a rewrite core library. It can be activated directly without adding any dependencies. |
| 64 | +<Tabs groupId="projectType"> |
| 65 | + |
| 66 | +<TabItem value="maven" label="Maven POM"> |
| 67 | + |
| 68 | +1. Add the following to your `pom.xml` file: |
| 69 | + |
| 70 | +```xml title="pom.xml" |
| 71 | +<project> |
| 72 | + <build> |
| 73 | + <plugins> |
| 74 | + <plugin> |
| 75 | + <groupId>org.openrewrite.maven</groupId> |
| 76 | + <artifactId>rewrite-maven-plugin</artifactId> |
| 77 | + <version>{{VERSION_REWRITE_MAVEN_PLUGIN}}</version> |
| 78 | + <configuration> |
| 79 | + <exportDatatables>true</exportDatatables> |
| 80 | + <activeRecipes> |
| 81 | + <recipe>org.openrewrite.maven.RemoveMavenWrapper</recipe> |
| 82 | + </activeRecipes> |
| 83 | + </configuration> |
| 84 | + </plugin> |
| 85 | + </plugins> |
| 86 | + </build> |
| 87 | +</project> |
| 88 | +``` |
| 89 | + |
| 90 | +2. Run `mvn rewrite:run` to run the recipe. |
| 91 | +</TabItem> |
| 92 | + |
| 93 | +<TabItem value="maven-command-line" label="Maven Command Line"> |
| 94 | + |
| 95 | +You will need to have [Maven](https://maven.apache.org/download.cgi) installed on your machine before you can run the following command. |
| 96 | + |
| 97 | +```shell title="shell" |
| 98 | +mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.activeRecipes=org.openrewrite.maven.RemoveMavenWrapper -Drewrite.exportDatatables=true |
| 99 | +``` |
| 100 | + |
| 101 | +</TabItem> |
| 102 | +<TabItem value="moderne-cli" label="Moderne CLI"> |
| 103 | + |
| 104 | +You will need to have configured the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro) on your machine before you can run the following command. |
| 105 | + |
| 106 | +```shell title="shell" |
| 107 | +mod run . --recipe RemoveMavenWrapper |
| 108 | +``` |
| 109 | + |
| 110 | +If the recipe is not available locally, then you can install it using: |
| 111 | +```shell |
| 112 | +mod config recipes jar install org.openrewrite:rewrite-maven:{{VERSION_ORG_OPENREWRITE_REWRITE_MAVEN}} |
| 113 | +``` |
| 114 | +</TabItem> |
| 115 | +</Tabs> |
| 116 | + |
| 117 | +## See how this recipe works across multiple open-source repositories |
| 118 | + |
| 119 | +import RecipeCallout from '@site/src/components/ModerneLink'; |
| 120 | + |
| 121 | +<RecipeCallout link="https://app.moderne.io/recipes/org.openrewrite.maven.RemoveMavenWrapper" /> |
| 122 | + |
| 123 | +The community edition of the Moderne platform enables you to easily run recipes across thousands of open-source repositories. |
| 124 | + |
| 125 | +Please [contact Moderne](https://moderne.io/product) for more information about safely running the recipes on your own codebase in a private SaaS. |
| 126 | +## Data Tables |
| 127 | + |
| 128 | +<Tabs groupId="data-tables"> |
| 129 | +<TabItem value="org.openrewrite.table.SourcesFileResults" label="SourcesFileResults"> |
| 130 | + |
| 131 | +### Source files that had results |
| 132 | +**org.openrewrite.table.SourcesFileResults** |
| 133 | + |
| 134 | +_Source files that were modified by the recipe run._ |
| 135 | + |
| 136 | +| Column Name | Description | |
| 137 | +| ----------- | ----------- | |
| 138 | +| Source path before the run | The source path of the file before the run. `null` when a source file was created during the run. | |
| 139 | +| Source path after the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | |
| 140 | +| Parent of the recipe that made changes | In a hierarchical recipe, the parent of the recipe that made a change. Empty if this is the root of a hierarchy or if the recipe is not hierarchical at all. | |
| 141 | +| Recipe that made changes | The specific recipe that made a change. | |
| 142 | +| Estimated time saving | An estimated effort that a developer to fix manually instead of using this recipe, in unit of seconds. | |
| 143 | +| Cycle | The recipe cycle in which the change was made. | |
| 144 | + |
| 145 | +</TabItem> |
| 146 | + |
| 147 | +<TabItem value="org.openrewrite.table.SearchResults" label="SearchResults"> |
| 148 | + |
| 149 | +### Source files that had search results |
| 150 | +**org.openrewrite.table.SearchResults** |
| 151 | + |
| 152 | +_Search results that were found during the recipe run._ |
| 153 | + |
| 154 | +| Column Name | Description | |
| 155 | +| ----------- | ----------- | |
| 156 | +| Source path of search result before the run | The source path of the file with the search result markers present. | |
| 157 | +| Source path of search result after run the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | |
| 158 | +| Result | The trimmed printed tree of the LST element that the marker is attached to. | |
| 159 | +| Description | The content of the description of the marker. | |
| 160 | +| Recipe that added the search marker | The specific recipe that added the Search marker. | |
| 161 | + |
| 162 | +</TabItem> |
| 163 | + |
| 164 | +<TabItem value="org.openrewrite.table.SourcesFileErrors" label="SourcesFileErrors"> |
| 165 | + |
| 166 | +### Source files that errored on a recipe |
| 167 | +**org.openrewrite.table.SourcesFileErrors** |
| 168 | + |
| 169 | +_The details of all errors produced by a recipe run._ |
| 170 | + |
| 171 | +| Column Name | Description | |
| 172 | +| ----------- | ----------- | |
| 173 | +| Source path | The file that failed to parse. | |
| 174 | +| Recipe that made changes | The specific recipe that made a change. | |
| 175 | +| Stack trace | The stack trace of the failure. | |
| 176 | + |
| 177 | +</TabItem> |
| 178 | + |
| 179 | +<TabItem value="org.openrewrite.table.RecipeRunStats" label="RecipeRunStats"> |
| 180 | + |
| 181 | +### Recipe performance |
| 182 | +**org.openrewrite.table.RecipeRunStats** |
| 183 | + |
| 184 | +_Statistics used in analyzing the performance of recipes._ |
| 185 | + |
| 186 | +| Column Name | Description | |
| 187 | +| ----------- | ----------- | |
| 188 | +| The recipe | The recipe whose stats are being measured both individually and cumulatively. | |
| 189 | +| Source file count | The number of source files the recipe ran over. | |
| 190 | +| Source file changed count | The number of source files which were changed in the recipe run. Includes files created, deleted, and edited. | |
| 191 | +| Cumulative scanning time (ns) | The total time spent across the scanning phase of this recipe. | |
| 192 | +| Max scanning time (ns) | The max time scanning any one source file. | |
| 193 | +| Cumulative edit time (ns) | The total time spent across the editing phase of this recipe. | |
| 194 | +| Max edit time (ns) | The max time editing any one source file. | |
| 195 | + |
| 196 | +</TabItem> |
| 197 | + |
| 198 | +</Tabs> |
0 commit comments