private void copyResources()

in src/main/java/org/apache/maven/report/projectinfo/DependenciesReport.java [198:221]


    private void copyResources(File outputDirectory) throws IOException {
        InputStream resourceList = getClass().getClassLoader().getResourceAsStream(RESOURCES_DIR + "/resources.txt");
        if (resourceList != null) {
            try (BufferedReader reader =
                    new LineNumberReader(new InputStreamReader(resourceList, StandardCharsets.US_ASCII))) {
                for (String line = reader.readLine(); line != null; line = reader.readLine()) {
                    try (InputStream in = getClass().getClassLoader().getResourceAsStream(RESOURCES_DIR + "/" + line)) {
                        if (in == null) {
                            throw new IOException("The resource " + line + " doesn't exist.");
                        }

                        File outputFile = new File(outputDirectory, line);
                        if (!outputFile.getParentFile().exists()) {
                            outputFile.getParentFile().mkdirs();
                        }

                        try (OutputStream out = new FileOutputStream(outputFile)) {
                            IOUtil.copy(in, out);
                        }
                    }
                }
            }
        }
    }