private StringBuilder buildArtifactListOutput()

in src/main/java/org/apache/maven/plugins/dependency/resolvers/ResolveDependenciesMojo.java [175:230]


    private StringBuilder buildArtifactListOutput(
            Set<Artifact> artifacts, boolean outputAbsoluteArtifactFilename, boolean theOutputScope, boolean theSort) {
        StringBuilder sb = new StringBuilder();
        List<String> artifactStringList = new ArrayList<>();
        for (Artifact artifact : artifacts) {
            MessageBuilder messageBuilder = MessageUtils.buffer();

            messageBuilder.a("   ");

            if (theOutputScope) {
                messageBuilder.a(artifact.toString());
            } else {
                messageBuilder.a(artifact.getId());
            }

            if (outputAbsoluteArtifactFilename) {
                try {
                    // we want to print the absolute file name here
                    String artifactFilename =
                            artifact.getFile().getAbsoluteFile().getPath();

                    messageBuilder.a(':').a(artifactFilename);
                } catch (NullPointerException e) {
                    // ignore the null pointer, we'll output a null string
                }
            }

            if (theOutputScope && artifact.isOptional()) {
                messageBuilder.a(" (optional)");
            }

            // dependencies:collect won't download jars
            if (artifact.getFile() != null) {
                ModuleDescriptor moduleDescriptor = getModuleDescriptor(artifact.getFile());
                if (moduleDescriptor != null) {
                    messageBuilder.project(" -- module " + moduleDescriptor.name);

                    if (moduleDescriptor.automatic) {
                        if ("MANIFEST".equals(moduleDescriptor.moduleNameSource)) {
                            messageBuilder.strong(" [auto]");
                        } else {
                            messageBuilder.warning(" (auto)");
                        }
                    }
                }
            }
            artifactStringList.add(messageBuilder + System.lineSeparator());
        }
        if (theSort) {
            Collections.sort(artifactStringList);
        }
        for (String artifactString : artifactStringList) {
            sb.append(artifactString);
        }
        return sb;
    }