protected void writeArtifacts()

in core-it-support/core-it-plugins/maven-it-plugin-dependency-collection/src/main/java/org/apache/maven/plugin/coreit/AbstractDependencyMojo.java [56:95]


    protected void writeArtifacts(String pathname, Collection artifacts) throws MojoExecutionException {
        if (pathname == null || pathname.length() <= 0) {
            return;
        }

        File file = resolveFile(pathname);

        getLog().info("[MAVEN-CORE-IT-LOG] Dumping artifact list: " + file);

        BufferedWriter writer = null;
        try {
            file.getParentFile().mkdirs();

            writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8"));

            if (artifacts != null) {
                for (Object artifact1 : artifacts) {
                    Artifact artifact = (Artifact) artifact1;
                    writer.write(artifact.getId());
                    String optional = "";
                    if (artifact.isOptional()) {
                        optional = " (optional)";
                        writer.write(optional);
                    }
                    writer.newLine();
                    getLog().info("[MAVEN-CORE-IT-LOG]   " + artifact.getId() + optional);
                }
            }
        } catch (IOException e) {
            throw new MojoExecutionException("Failed to write artifact list", e);
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    // just ignore
                }
            }
        }
    }