use of org.apache.maven.shared.filtering.MavenResourcesExecution in project maven-plugins by apache.
the class RarMojo method resourceHandling.
private void resourceHandling() throws MojoExecutionException {
Resource resource = new Resource();
resource.setDirectory(rarSourceDirectory.getAbsolutePath());
resource.setTargetPath(getBuildDir().getAbsolutePath());
resource.setFiltering(filterRarSourceDirectory);
List<Resource> resources = new ArrayList<Resource>();
resources.add(resource);
if (rarResources != null && !rarResources.isEmpty()) {
resources.addAll(rarResources);
}
MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution(resources, getBuildDir(), project, encoding, filters, Collections.<String>emptyList(), session);
mavenResourcesExecution.setEscapeWindowsPaths(escapeWindowsPaths);
// never include project build filters in this call, since we've already accounted for the POM build filters
// above, in getCombinedFiltersList().
mavenResourcesExecution.setInjectProjectBuildFilters(false);
mavenResourcesExecution.setEscapeString(escapeString);
mavenResourcesExecution.setOverwrite(overwrite);
mavenResourcesExecution.setIncludeEmptyDirs(includeEmptyDirs);
mavenResourcesExecution.setSupportMultiLineFiltering(supportMultiLineFiltering);
mavenResourcesExecution.setDelimiters(delimiters, useDefaultDelimiters);
if (nonFilteredFileExtensions != null) {
mavenResourcesExecution.setNonFilteredFileExtensions(nonFilteredFileExtensions);
}
try {
mavenResourcesFiltering.filterResources(mavenResourcesExecution);
} catch (MavenFilteringException e) {
throw new MojoExecutionException("Error copying RAR resources", e);
}
}
use of org.apache.maven.shared.filtering.MavenResourcesExecution in project maven-plugins by apache.
the class EarMojo method getFilterWrappers.
private List<FileUtils.FilterWrapper> getFilterWrappers() throws MojoExecutionException {
if (filterWrappers == null) {
try {
MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution();
mavenResourcesExecution.setMavenProject(getProject());
mavenResourcesExecution.setEscapedBackslashesInFilePath(escapedBackslashesInFilePath);
mavenResourcesExecution.setFilters(filters);
mavenResourcesExecution.setEscapeString(escapeString);
filterWrappers = mavenFileFilter.getDefaultFilterWrappers(mavenResourcesExecution);
} catch (MavenFilteringException e) {
getLog().error("Fail to build filtering wrappers " + e.getMessage());
throw new MojoExecutionException(e.getMessage(), e);
}
}
return filterWrappers;
}
Aggregations