protected Map scanArchive()

in maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/DefaultMojoAnnotationsScanner.java [155:185]


    protected Map<String, MojoAnnotatedClass> scanArchive(File archiveFile, Artifact artifact, boolean excludeMojo)
            throws IOException, ExtractionException {
        Map<String, MojoAnnotatedClass> mojoAnnotatedClasses = new HashMap<>();

        String zipEntryName = null;
        try (ZipInputStream archiveStream = new ZipInputStream(new FileInputStream(archiveFile))) {
            String archiveFilename = archiveFile.getAbsolutePath();
            for (ZipEntry zipEntry = archiveStream.getNextEntry();
                    zipEntry != null;
                    zipEntry = archiveStream.getNextEntry()) {
                zipEntryName = zipEntry.getName();
                if (!SCANNABLE_CLASS.matcher(zipEntryName).matches()) {
                    continue;
                }
                analyzeClassStream(
                        mojoAnnotatedClasses,
                        archiveStream,
                        artifact,
                        excludeMojo,
                        archiveFilename,
                        zipEntry.getName());
            }
        } catch (IllegalArgumentException e) {
            // In case of a class with newer specs an IllegalArgumentException can be thrown
            LOGGER.error("Failed to analyze " + archiveFile.getAbsolutePath() + "!/" + zipEntryName);

            throw e;
        }

        return mojoAnnotatedClasses;
    }