Search in sources :

Example 6 with MavenResourcesExecution

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);
    }
}
Also used : MavenResourcesExecution(org.apache.maven.shared.filtering.MavenResourcesExecution) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) MavenFilteringException(org.apache.maven.shared.filtering.MavenFilteringException) Resource(org.apache.maven.model.Resource) ArrayList(java.util.ArrayList)

Example 7 with MavenResourcesExecution

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;
}
Also used : MavenResourcesExecution(org.apache.maven.shared.filtering.MavenResourcesExecution) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) MavenFilteringException(org.apache.maven.shared.filtering.MavenFilteringException)

Aggregations

MavenResourcesExecution (org.apache.maven.shared.filtering.MavenResourcesExecution)7 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)6 MavenFilteringException (org.apache.maven.shared.filtering.MavenFilteringException)6 File (java.io.File)2 ArrayList (java.util.ArrayList)2 FilterWrapper (org.apache.maven.shared.utils.io.FileUtils.FilterWrapper)2 IOException (java.io.IOException)1 LinkedHashSet (java.util.LinkedHashSet)1 List (java.util.List)1 Properties (java.util.Properties)1 MavenArchiver (org.apache.maven.archiver.MavenArchiver)1 DependencyResolutionRequiredException (org.apache.maven.artifact.DependencyResolutionRequiredException)1 Resource (org.apache.maven.model.Resource)1 OverlayManager (org.apache.maven.plugins.war.overlay.OverlayManager)1 WarPackagingContext (org.apache.maven.plugins.war.packaging.WarPackagingContext)1 WarPackagingTask (org.apache.maven.plugins.war.packaging.WarPackagingTask)1 WarPostPackagingTask (org.apache.maven.plugins.war.packaging.WarPostPackagingTask)1 WebappStructure (org.apache.maven.plugins.war.util.WebappStructure)1 ArchiverException (org.codehaus.plexus.archiver.ArchiverException)1 ManifestException (org.codehaus.plexus.archiver.jar.ManifestException)1