in tomee-patch-plugin/src/main/java/org/apache/tomee/patch/plugin/PatchMojo.java [648:677]
private void copy(final File root, final File src, final File dest) {
copy:
for (final File file : src.listFiles()) {
final String path = file.getAbsolutePath().substring(root.getAbsolutePath().length() + 1);
for (final String exclude : sourceExcludes) {
if (path.replace(File.separatorChar, '/').matches(exclude)) {
getLog().debug("Exclude source file: " + file.getAbsolutePath());
continue copy;
}
}
if (file.isDirectory()) {
final File dir = new File(dest, file.getName());
Files.mkdir(dir);
copy(root, file, dir);
} else if (file.isFile()) {
try (InputStream in = IO.read(file)) {
if (!skipTransform && transformSources) {
IO.copy(updateImports(in), new File(dest, file.getName()));
} else {
IO.copy(in, new File(dest, file.getName()));
}
} catch (IOException e) {
throw new UncheckedIOException("Cannot copy file " + file.getAbsolutePath(), e);
}
}
}
}