All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.keub.maven.plugin.service.IncludeService Maven / Gradle / Ivy

Go to download

Copy files from a remote location to a path relative to the project in which the plugin is configured.

There is a newer version: 1.8
Show newest version
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 IncludeService {

	/**
	 * include only file match with pattern into includes set
	 * 
	 * @param includes
	 * @param files
	 */
	public static Set process(Set includes, Set files) {
		if (includes == null || files == null) {
			return files;
		}
		Set retval = new HashSet();
		AntPathMatcher antPathMatcher = new AntPathMatcher();
		for (String pattern : includes) {
			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