private void writeToFile()

in build-tools/src/main/java/co/elastic/otel/android/compilation/tools/tasks/subprojects/PomLicensesCollectorTask.java [85:100]


    private void writeToFile(File licensesFoundFile, List<ArtifactLicense> artifactLicenses) throws IOException {
        FileWriter fileWriter = new FileWriter(licensesFoundFile);
        PrintWriter printWriter = new PrintWriter(fileWriter);
        boolean firstIteration = true;

        for (ArtifactLicense artifactLicense : artifactLicenses) {
            if (!firstIteration) {
                printWriter.println();
            } else {
                firstIteration = false;
            }
            printWriter.print(artifactLicense.serialize());
        }

        printWriter.close();
    }