patch:apply
Full name:
org.apache.maven.plugins:maven-patch-plugin:1.3:apply
Description:
Apply one or more patches to project sources.
Attributes:
- Requires a Maven project to be executed.
- The goal is not marked as thread-safe and thus does not support parallel builds.
- Binds by default to the lifecycle phase: process-sources.
Optional Parameters
| Name | Type | Since | Description | 
|---|---|---|---|
| <backups> | boolean | - | Whether to make backups of the original files before modding them. Default: false | 
| <binary> | boolean | 1.2 | apply --binary option to patch command line Default: false | 
| <destFile> | File | - | The output file which is the original file, plus modifications from the patch. By default, the file(s) will be patched inplace. | 
| <excludes> | List<String> | 1.3 | List of ANT-style exclude patterns. These patterns are used to exclude patch files found in the patchDirectory. These exclude patterns does not apply to a static defined list ofpatches. | 
| <failFast> | boolean | - | Flag being trueif the desired behavior is to fail the build on the first failed patch detected.Default: true | 
| <failurePhrases> | List<String> | - | List of phrases to watch for in the command output from the patch tool. If one is found, it will cause the build to fail. All phrases should be lower-case only. By default, the phrases fail,skipandrejectare used. | 
| <ignoreWhitespace> | boolean | - | Whether to ignore whitespaces when applying the patches. Default: true | 
| <ignoredPatches> | List | - | When the strictPatchingflag is set, this parameter is useful to mark certain contents of the patch-source directory that should be ignored without causing the build to fail. | 
| <naturalOrderProcessing> | boolean | - | Setting natural order processing to truewill cause all patches in a directory to be processed in a natural order alleviating the need to declare patches directly in the project file.Default: false | 
| <optimizations> | boolean | - | Flag to enable/disable optimization file from being written. This file tracks the patches that were applied the last time this goal actually executed. It is required for cases where project-sources optimizations are enabled, since project-sources will not be re-unpacked if they are at least as fresh as the source archive. If we avoid re-unpacking project sources, we need to make sure we don't reapply patches. Note: If the list of patches changes and this flag is enabled, a " mvn clean" must be executed before the next build, to remove the tracking file.Default: true | 
| <originalFile> | File | - | The original file which will be modified by the patch. By default, the patch tool will automatically derive the original file from the header of the patch file. | 
| <patchDirectory> | File | - | The base directory for the file names specified by the parameter patches.Default: src/main/patches | 
| <patchFile> | File | - | The single patch file to apply. This parameter is mutually exclusive with the patchesparameter. | 
| <patchTrackingFile> | File | - | This is the tracking file used to maintain a list of the patches applied to the unpacked project sources which are currently in the target directory. If this file is present, and project-source unpacking is optimized (meaning it won't re-unpack unless the project-sources archive is newer), this goal will not execute and no patches will be applied in the current build. Default: ${project.build.directory}/optimization-files/patches-applied.txt | 
| <patches> | List<String> | - | The list of patch file names, supplying the order in which patches should be applied. The path names in this list must be relative to the base directory specified by the parameter patchDirectory. This parameter is mutually exclusive with thepatchfileparameter. | 
| <removeEmptyFiles> | boolean | 1.1 | When set to true, the empty files resulting from the patching process are removed. Empty ancestor directories are removed as well.Default: false | 
| <reverse> | boolean | - | Whether to treat these patches as having reversed source and dest in the patch syntax. Default: false | 
| <skipApplication> | boolean | - | Whether to skip this goal's execution. Default: falseAlias: patch.apply.skip | 
| <strictPatching> | boolean | - | Flag that, when set to true, will make sure that all patches included in thepatcheslist must be present and describe the full contents of the patch directory. IfstrictPatchingis set totrue, and thepatcheslist has a value that does not correspond to a file in the patch directory, the build will fail. IfstrictPatchingis set totrue, and the patch directory contains files not listed in thepatchesparameter, the build will fail. If set tofalse, only the patches listed in thepatchesparameter that have corresponding files will be applied; the rest will be ignored.Default: false | 
| <strip> | int | - | The number of directories to be stripped from patch file paths, before applying, starting from the leftmost, or root-est. Default: 0 | 
| <targetDirectory> | File | - | The target directory for applying patches. Files in this directory will be modified. Default: ${project.build.sourceDirectory}Alias: patchTargetDir | 
| <useDefaultIgnores> | boolean | - | Whether to exclude default ignored patch items, such as .svnorCVSdirectories.Default: true | 
Parameter Details
<backups>
Whether to make backups of the original files before modding them.
- Type: boolean
- Required: No
- Default: false
<binary>
apply --binary option to patch command line
- Type: boolean
- Since: 1.2
- Required: No
- Default: false
<destFile>
The output file which is the original file, plus modifications from the patch. By default, the file(s) will be patched inplace.
- Type: java.io.File
- Required: No
<excludes>
List of ANT-style exclude patterns. These patterns are used to exclude patch files found in the 
patchDirectory. These exclude patterns does not apply to a static defined list of patches.- Type: java.util.List<java.lang.String>
- Since: 1.3
- Required: No
<failFast>
Flag being 
true if the desired behavior is to fail the build on the first failed patch detected.- Type: boolean
- Required: No
- Default: true
<failurePhrases>
List of phrases to watch for in the command output from the patch tool. If one is found, it will cause the build to fail. All phrases should be lower-case only. By default, the phrases 
fail, skip and reject are used.- Type: java.util.List<java.lang.String>
- Required: No
<ignoreWhitespace>
Whether to ignore whitespaces when applying the patches.
- Type: boolean
- Required: No
- Default: true
<ignoredPatches>
When the 
strictPatching flag is set, this parameter is useful to mark certain contents of the patch-source directory that should be ignored without causing the build to fail.- Type: java.util.List
- Required: No
<naturalOrderProcessing>
Setting natural order processing to 
true will cause all patches in a directory to be processed in a natural order alleviating the need to declare patches directly in the project file.- Type: boolean
- Required: No
- Default: false
<optimizations>
Flag to enable/disable optimization file from being written. This file tracks the patches that were applied the last time this goal actually executed. It is required for cases where project-sources optimizations are enabled, since project-sources will not be re-unpacked if they are at least as fresh as the source archive. If we avoid re-unpacking project sources, we need to make sure we don't reapply patches.
Note: If the list of patches changes and this flag is enabled, a "
Note: If the list of patches changes and this flag is enabled, a "
mvn clean" must be executed before the next build, to remove the tracking file.- Type: boolean
- Required: No
- Default: true
<originalFile>
The original file which will be modified by the patch. By default, the patch tool will automatically derive the original file from the header of the patch file.
- Type: java.io.File
- Required: No
<patchDirectory>
The base directory for the file names specified by the parameter 
patches.- Type: java.io.File
- Required: No
- Default: src/main/patches
<patchFile>
The single patch file to apply. This parameter is mutually exclusive with the 
patches parameter.- Type: java.io.File
- Required: No
<patchTrackingFile>
This is the tracking file used to maintain a list of the patches applied to the unpacked project sources which are currently in the target directory. If this file is present, and project-source unpacking is optimized (meaning it won't re-unpack unless the project-sources archive is newer), this goal will not execute and no patches will be applied in the current build.
- Type: java.io.File
- Required: No
- Default: ${project.build.directory}/optimization-files/patches-applied.txt
<patches>
The list of patch file names, supplying the order in which patches should be applied. The path names in this list must be relative to the base directory specified by the parameter 
patchDirectory. This parameter is mutually exclusive with the patchfile parameter.- Type: java.util.List<java.lang.String>
- Required: No
<removeEmptyFiles>
When set to 
true, the empty files resulting from the patching process are removed. Empty ancestor directories are removed as well.- Type: boolean
- Since: 1.1
- Required: No
- Default: false
<reverse>
Whether to treat these patches as having reversed source and dest in the patch syntax.
- Type: boolean
- Required: No
- Default: false
<skipApplication>
Whether to skip this goal's execution.
- Type: boolean
- Required: No
- Default: false
- Alias: patch.apply.skip
<strictPatching>
Flag that, when set to 
true, will make sure that all patches included in the patches list must be present and describe the full contents of the patch directory. If strictPatching is set to true, and the patches list has a value that does not correspond to a file in the patch directory, the build will fail. If strictPatching is set to true, and the patch directory contains files not listed in the patches parameter, the build will fail. If set to false, only the patches listed in the patches parameter that have corresponding files will be applied; the rest will be ignored.- Type: boolean
- Required: No
- Default: false
<strip>
The number of directories to be stripped from patch file paths, before applying, starting from the leftmost, or root-est.
- Type: int
- Required: No
- Default: 0
<targetDirectory>
The target directory for applying patches. Files in this directory will be modified.
- Type: java.io.File
- Required: No
- Default: ${project.build.sourceDirectory}
- Alias: patchTargetDir
<useDefaultIgnores>
Whether to exclude default ignored patch items, such as 
.svn or CVS directories.- Type: boolean
- Required: No
- Default: true


