public static boolean isWebJar(File file) {
        Set<String> found = new LinkedHashSet<>();
        if (file.isFile() && file.getName().endsWith(".jar")) {
            JarFile jar = null;
            try {
                jar = new JarFile(file);

                // Fast return if the base structure is not there
                if (jar.getEntry(WEBJAR_LOCATION) == null) {
                    return false;
                }

                Enumeration<JarEntry> entries = jar.entries();
                while (entries.hasMoreElements()) {
                    JarEntry entry = entries.nextElement();
                    Matcher matcher = WEBJAR_REGEX.matcher(entry.getName());
                    if (matcher.matches()) {
                        found.add(matcher.group(1) + "-" + matcher.group(2));
                    }
                }
            } catch (IOException e) {
                LoggerFactory.getLogger(DependencyCopy.class).error("Cannot check if the file {} is a webjar, " +
                        "cannot open it", file.getName(), e);
                return false;
            } finally {
                final JarFile finalJar = jar;
                IOUtils.closeQuietly(new Closeable() {
                    @Override
                    public void close() throws IOException {
                        if (finalJar != null) {
                            finalJar.close();
                        }
                    }
                });
            }

            for (String lib : found) {
                LoggerFactory.getLogger(DependencyCopy.class).info("Web Library found in {} : {}",
                        file.getName(), lib);
            }

            return !found.isEmpty();
        }

        return false;
    }
public static boolean isWebJar ( File file ) { Set < String > found = new LinkedHashSet < > ( ) ; if ( file . isFile ( ) && file . getName ( ) . endsWith ( ".jar" ) ) { JarFile jar = null ; try { jar = new JarFile ( file ) ; if ( jar . getEntry ( WEBJAR_LOCATION ) == null ) { return false ; } Enumeration < JarEntry > entries = jar . entries ( ) ; while ( entries . hasMoreElements ( ) ) { JarEntry entry = entries . nextElement ( ) ; Matcher matcher = WEBJAR_REGEX . matcher ( entry . getName ( ) ) ; if ( matcher . matches ( ) ) { found . add ( matcher . group ( 1 ) + "-" + matcher . group ( 2 ) ) ; } } } catch ( IOException e ) { LoggerFactory . getLogger ( DependencyCopy . class ) . error ( "Cannot check if the file {} is a webjar, " + "cannot open it" , file . getName ( ) , e ) ; return false ; } finally { final JarFile finalJar = jar ; IOUtils . closeQuietly ( new Closeable ( ) { @ Override public void close ( ) throws IOException { if ( finalJar != null ) { finalJar . close ( ) ; } } } ) ; } for ( String lib : found ) { LoggerFactory . getLogger ( DependencyCopy . class ) . info ( "Web Library found in {} : {}" , file . getName ( ) , lib ) ; } return ! found . isEmpty ( ) ; } return false ; }
Checks whether the given file is a WebJar or not (http://www.webjars.org/documentation).
The check is based on the presence of {@literal META-INF/resources/webjars/} directory in the jar file.

@param file the file.
@return {@literal true} if it's a bundle, {@literal false} otherwise.