Example usage for org.apache.commons.io.manifest ManifestUtils findFirstManifestAttributeValue

List of usage examples for org.apache.commons.io.manifest ManifestUtils findFirstManifestAttributeValue

Introduction

In this page you can find the example usage for org.apache.commons.io.manifest ManifestUtils findFirstManifestAttributeValue.

Prototype

public static final Pair<Attributes.Name, String> findFirstManifestAttributeValue(JarFile jarFile,
        Collection<? extends Attributes.Name> names) throws IOException 

Source Link

Document

Scans the main section of a JAR file manifest for the 1st non-empty attribute value

Usage

From source file:net.community.chest.gitcloud.facade.AbstractContextInitializer.java

protected void showArtifactsVersions() {
    scanArtifactsManifests(new Predicate<Pair<URL, Manifest>>() {
        @Override//from www.  ja va2s .  c  om
        @SuppressWarnings("synthetic-access")
        public boolean evaluate(Pair<URL, Manifest> e) {
            URL url = e.getKey();
            Manifest manifest = e.getValue();
            Pair<Attributes.Name, String> versionInfo = ManifestUtils.findFirstManifestAttributeValue(manifest,
                    ManifestUtils.STANDARD_VERSION_ATTRS_NAMES);
            if (versionInfo == null) {
                logger.info(
                        "showArtifactsVersions(" + url.toExternalForm() + ") no version information extracted");
            } else {
                logger.info("showArtifactsVersions(" + url.toExternalForm() + ")[" + versionInfo.getLeft()
                        + "]: " + versionInfo.getRight());
            }

            return false; // don't stop
        }
    });
}