src/main/java/net/wasdev/wlp/common/plugins/util/SpringBootUtil.java
public static boolean isSpringBootUberJar(File artifact) {
        if (artifact == null || !artifact.exists() || !artifact.isFile()) {
            return false;
        }

        try (JarFile jarFile = new JarFile(artifact)) {
            Manifest manifest = jarFile.getManifest();
            if (manifest != null) {
                Attributes attributes = manifest.getMainAttributes();
                if(attributes.getValue(BOOT_VERSION_ATTRIBUTE) != null
                        && attributes.getValue(BOOT_START_CLASS_ATTRIBUTE) != null) {
                    return true;
                } else { //Checking that there is a spring-boot-VERSION.RELEASE.jar in the BOOT-INF/lib directory
                         //Handles the Gradle case where the spring plugin does not set the properties in the manifest
                    Enumeration<JarEntry> entries = jarFile.entries();
                    while(entries.hasMoreElements()) {
                        JarEntry entry = entries.nextElement();
                        String entryName = entry.getName();
                        if (!entryName.startsWith("org") && (entryName.matches(BOOT_JAR_EXPRESSION) || entryName.matches(BOOT_WAR_EXPRESSION))) {                        
                            return true;
                        }         
                    }
                }
            }
        } catch (IOException e) {}
        return false;
    }
public static boolean isSpringBootUberJar(File artifact) {
        if (artifact == null || !artifact.exists() || !artifact.isFile()) {
            return false;
        }

        try (JarFile jarFile = new JarFile(artifact)) {
            Manifest manifest = jarFile.getManifest();
            if (manifest != null) {
                Attributes attributes = manifest.getMainAttributes();
                if(attributes.getValue(BOOT_VERSION_ATTRIBUTE) != null
                        && attributes.getValue(BOOT_START_CLASS_ATTRIBUTE) != null) {
                    return true;
                } else { //Checking that there is a spring-boot-VERSION.RELEASE.jar in the BOOT-INF/lib directory
                         //Handles the Gradle case where the spring plugin does not set the properties in the manifest
                    Enumeration<JarEntry> entries = jarFile.entries();
                    while(entries.hasMoreElements()) {
                        JarEntry entry = entries.nextElement();
                        String entryName = entry.getName();
                        if (!entryName.startsWith("org") && (entryName.matches(BOOT_JAR_EXPRESSION) || entryName.matches(BOOT_WAR_EXPRESSION))) {                        
                            return true;
                        }         
                    }
                }
            }
        } catch (IOException e) {}
        return false;
    }
public static boolean isSpringBootUberJar ( File artifact ) { if ( artifact == null || ! artifact . exists ( ) || ! artifact . isFile ( ) ) { return false ; } try ( JarFile jarFile = new JarFile ( artifact ) ) { Manifest manifest = jarFile . getManifest ( ) ; if ( manifest != null ) { Attributes attributes = manifest . getMainAttributes ( ) ; if ( attributes . getValue ( BOOT_VERSION_ATTRIBUTE ) != null && attributes . getValue ( BOOT_START_CLASS_ATTRIBUTE ) != null ) { return true ; } else { //Checking that there is a spring-boot-VERSION.RELEASE.jar in the BOOT-INF/lib directory //Handles the Gradle case where the spring plugin does not set the properties in the manifest Enumeration < JarEntry > entries = jarFile . entries ( ) ; while ( entries . hasMoreElements ( ) ) { JarEntry entry = entries . nextElement ( ) ; String entryName = entry . getName ( ) ; if ( ! entryName . startsWith ( "org" ) && ( entryName . matches ( BOOT_JAR_EXPRESSION ) || entryName . matches ( BOOT_WAR_EXPRESSION ) ) ) { return true ; } } } } } catch ( IOException e ) { } return false ; }
Check whether the given artifact is a Spring Boot Uber JAR
@param artifact
@return true if so, false otherwise
Check whether the given artifact is a Spring Boot Uber JAR