in tomee-patch-plugin/src/main/java/org/apache/tomee/patch/plugin/PatchMojo.java [287:335]
public void execute() throws MojoExecutionException, CompilationFailureException {
try {
Files.mkdir(patchClasspathDirectory);
// Select the zip files and jars we'll be potentially patching
final List<Artifact> artifacts = getPatchArtifacts();
prepareResources();
// Extract any zips and return a list of jars
final List<File> jars = prepareJars(artifacts);
compile(jars);
final List<Clazz> clazzes = classes();
final Transformation transformation = new Transformation(clazzes, patchResourceDirectory, replace, skips, add, new MavenLog(getLog()), skipTransform);
for (final Artifact artifact : artifacts) {
final File file = artifact.getFile();
getLog().debug("Patching " + file.getAbsolutePath());
final File patched = transformation.transformArchive(file);
IO.copy(patched, file);
if (createTarGz && file.getName().endsWith(".zip")) {
final File tarGz;
try {
tarGz = ZipToTar.toTarGz(file);
} catch (Exception e) {
getLog().error("Failed to create tar.gz from " + file.getAbsolutePath(), e);
continue;
}
if (attach) {
final String classifier = artifact.getClassifier();
final AttachedArtifact attachedArtifact = new AttachedArtifact(project.getArtifact(), "tar.gz", classifier, project.getArtifact().getArtifactHandler());
attachedArtifact.setFile(tarGz);
attachedArtifact.setResolved(true);
project.addAttachedArtifact(attachedArtifact);
}
}
}
updateSourceJar();
transformation.complete();
} catch (IOException | MojoFailureException e) {
throw new MojoExecutionException("Error occurred during execution", e);
}
}