private List mergeDefaultExclusions()

in apache-rat-plugin/src/main/java/org/apache/rat/mp/AbstractRatMojo.java [424:476]


    private List<String> mergeDefaultExclusions() throws MojoExecutionException {
        final Set<String> results = new HashSet<>();

        addPlexusAndScmDefaults(getLog(), useDefaultExcludes, results);
        addMavenDefaults(getLog(), useMavenDefaultExcludes, results);
        addEclipseDefaults(getLog(), useEclipseDefaultExcludes, results);
        addIdeaDefaults(getLog(), useIdeaDefaultExcludes, results);

        if (parseSCMIgnoresAsExcludes) {
            getLog().debug("Will parse SCM ignores for exclusions...");
            results.addAll(ScmIgnoreParser.getExclusionsFromSCM(getLog(), project.getBasedir()));
            getLog().debug("Finished adding exclusions from SCM ignore files.");
        }

        if (excludeSubProjects && project != null
                && project.getModules() != null) {
            for (final Object o : project.getModules()) {
                final String moduleSubPath = (String) o;
                if (new File( basedir, moduleSubPath ).isDirectory()) {
                    results.add(moduleSubPath + "/**/*");
                }
                else {
                    results.add(StringUtils.substringBeforeLast( moduleSubPath, "/" ) + "/**/*");
                }
            }
        }

        getLog().debug("Finished creating list of implicit excludes.");
        if (results.isEmpty()) {
            getLog().debug("No excludes implicitly specified.");
        } else {
            getLog().debug(
                    results.size()
                            + " implicit excludes.");
            for (final String exclude : results) {
                getLog().debug("Implicit exclude: " + exclude);
            }
        }
        if (excludesFile != null) {
        	final File f = new File(excludesFile);
        	if (!f.isFile()) {
        		getLog().error("Excludes file not found: " + f.getAbsolutePath());
        	}
        	if (!f.canRead()) {
        		getLog().error("Excludes file not readable: " + f.getAbsolutePath());
        	}
        	final String charset = excludesFileCharset == null ? "UTF8" : excludesFileCharset;
        	getLog().debug("Loading excludes from file " + f + ", using character set " + charset);
        	results.addAll(getPatternsFromFile(f, charset));
        }

        return new ArrayList<>(results);
    }