public MinijarFilter()

in src/main/java/org/apache/maven/plugins/shade/filter/MinijarFilter.java [95:146]


    public MinijarFilter(MavenProject project, Log log, List<SimpleFilter> simpleFilters, Set<String> entryPoints)
            throws IOException {
        this.log = log;

        File artifactFile = project.getArtifact().getFile();

        if (artifactFile != null) {
            Clazzpath cp = new Clazzpath();

            ClazzpathUnit artifactUnit = cp.addClazzpathUnit(new FileInputStream(artifactFile), project.toString());

            for (Artifact dependency : project.getArtifacts()) {
                addDependencyToClasspath(cp, dependency);
            }

            removable = cp.getClazzes();
            if (removable.remove(new Clazz("module-info"))) {
                log.warn("Removing module-info from " + artifactFile.getName());
            }
            removePackages(artifactUnit);
            if (entryPoints.isEmpty()) {
                removable.removeAll(artifactUnit.getClazzes());
                removable.removeAll(artifactUnit.getTransitiveDependencies());
            } else {
                Set<Clazz> artifactUnitClazzes = artifactUnit.getClazzes();
                Set<Clazz> entryPointsToKeep = new HashSet<>();
                for (String entryPoint : entryPoints) {
                    Clazz entryPointFound = null;
                    for (Clazz clazz : artifactUnitClazzes) {
                        if (clazz.getName().equals(entryPoint)) {
                            entryPointFound = clazz;
                            break;
                        }
                    }
                    if (entryPointFound != null) {
                        entryPointsToKeep.add(entryPointFound);
                    }
                }
                removable.removeAll(entryPointsToKeep);
                if (entryPointsToKeep.isEmpty()) {
                    removable.removeAll(artifactUnit.getTransitiveDependencies());
                } else {
                    for (Clazz entryPoint : entryPointsToKeep) {
                        removable.removeAll(entryPoint.getTransitiveDependencies());
                    }
                }
            }
            removeSpecificallyIncludedClasses(
                    project, simpleFilters == null ? Collections.<SimpleFilter>emptyList() : simpleFilters);
            removeServices(project, cp);
        }
    }