in src/main/java/org/apache/tomee/website/Javadocs.java [200:230]
private void copySource(final Source parent, final Source source, final File javaSources) {
final JavadocSources javadocSources = new JavadocSources();
source.setComponent(JavadocSources.class, javadocSources);
final Predicate<String> wanted = wanted(parent, source);
try {
java.nio.file.Files.walk(source.getDir().toPath())
.map(Path::toFile)
.filter(File::isFile)
.filter(this::isJava)
.filter(source.getJavadocFilter()::include)
.filter(source.getJavadocFilter()::exclude)
.forEach(file -> {
try {
final String relativePath = file.getAbsolutePath().replace(File.separatorChar, '/').replaceAll(".*/src/main/java/", "");
if (!wanted.test(relativePath)) return;
final File dest = new File(javaSources, relativePath);
Files.mkdirs(dest.getParentFile());
IO.copy(file, dest);
javadocSources.add(new JavadocSource(relativePath, dest));
} catch (IOException e) {
throw new IllegalStateException(e);
}
});
} catch (IOException e) {
throw new IllegalStateException("Failed to aggregate java sources");
}
}