DEV Community

Query Filter
Query Filter

Posted on

dupl3

task checkSpecificConflict {
    doLast {
        def filesToScan = files(
            "libs/EQRioINtf-1.3_D5.jar", 
            "libs/OESIntf3_8-3.8_A29-SNAPSHOT.jar"
        )

        def classMap = [:]
        filesToScan.each { file ->
            if (file.exists()) {
                def zip = new java.util.zip.ZipFile(file)
                zip.entries().each { entry ->
                    if (entry.name.endsWith('.class')) {
                        if (classMap.containsKey(entry.name)) {
                            println "MATCH FOUND: ${entry.name}"
                            println "  Found in: ${classMap[entry.name]}"
                            println "  Found in: ${file.name}"
                        } else {
                            classMap[entry.name] = file.name
                        }
                    }
                }
                zip.close()
            } else {
                println "Could not find file: ${file.path}"
            }
        }
    }
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)