in src/main/java/org/apache/maven/plugin/patch/ApplyMojo.java [318:379]
private Map findPatchesToApply( List foundPatchFiles, File patchSourceDir )
throws MojoFailureException
{
Map patchesApplied = new LinkedHashMap();
if ( naturalOrderProcessing )
{
patches = new ArrayList( foundPatchFiles );
Collections.sort( patches );
}
String alreadyAppliedPatches = "";
try
{
if ( optimizations && patchTrackingFile.exists() )
{
alreadyAppliedPatches = FileUtils.fileRead( patchTrackingFile );
}
}
catch ( IOException ioe )
{
throw new MojoFailureException( "unable to read patch tracking file: " + ioe.getMessage() );
}
for ( Object patche : patches )
{
String patch = (String) patche;
if ( !alreadyAppliedPatches.contains( patch ) )
{
File patchFile = new File( patchSourceDir, patch );
getLog().debug( "Looking for patch: " + patch + " in: " + patchFile );
if ( !patchFile.exists() )
{
if ( strictPatching )
{
throw new MojoFailureException( this, "Patch operation cannot proceed.",
"Cannot find specified patch: \'" + patch
+ "\' in patch-source directory: \'" + patchSourceDir
+ "\'.\n\nEither fix this error, "
+ "or relax strictPatching." );
}
else
{
getLog().info( "Skipping patch: " + patch + " listed in the parameter \"patches\"; "
+ "it is missing." );
}
}
else
{
foundPatchFiles.remove( patch );
patchesApplied.put( patch, createPatchCommand( patchFile ) );
}
}
}
return patchesApplied;
}