protected void writeClassPath()

in core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/AbstractDependencyMojo.java [126:160]


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

        File file = resolveFile(pathname);

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

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

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

            if (classPath != null) {
                for (Object aClassPath : classPath) {
                    String element = aClassPath.toString();
                    writer.write(stripLeadingDirs(element, significantPathLevels));
                    writer.newLine();
                    getLog().info("[MAVEN-CORE-IT-LOG]   " + element);
                }
            }
        } catch (IOException e) {
            throw new MojoExecutionException("Failed to write class path list", e);
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    // just ignore
                }
            }
        }
    }