com.github.keub.maven.plugin.service.ExcludeService Maven / Gradle / Ivy
package com.github.keub.maven.plugin.service;
import java.util.HashSet;
import java.util.Set;
import com.github.keub.maven.plugin.utils.AntPathMatcher;
import com.github.keub.maven.plugin.utils.FileUtils;
public class ExcludeService {
/**
*
* exclude only file match with pattern into includes set
*
*
* @param excludes
* ant patterns collection
* @param files
* files set to process
* @return files set
*
*/
public static Set process(Set excludes, Set files) {
if (excludes == null || files == null) {
return files;
}
Set retval = new HashSet();
AntPathMatcher antPathMatcher = new AntPathMatcher();
for (String pattern : excludes) {
for (String path : files) {
boolean match = antPathMatcher.match(pattern,
FileUtils.normalizePath(path));
if (!match) {
retval.add(path);
}
}
}
return retval;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy