当前位置: 首页>>代码示例>>Java>>正文


Java MavenResourcesFiltering.filterResources方法代码示例

本文整理汇总了Java中org.apache.maven.shared.filtering.MavenResourcesFiltering.filterResources方法的典型用法代码示例。如果您正苦于以下问题:Java MavenResourcesFiltering.filterResources方法的具体用法?Java MavenResourcesFiltering.filterResources怎么用?Java MavenResourcesFiltering.filterResources使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.maven.shared.filtering.MavenResourcesFiltering的用法示例。


在下文中一共展示了MavenResourcesFiltering.filterResources方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: executeUserFilterComponents

import org.apache.maven.shared.filtering.MavenResourcesFiltering; //导入方法依赖的package包/类
protected void executeUserFilterComponents(MavenResourcesExecution mavenResourcesExecution)
		throws MojoExecutionException, MavenFilteringException {

	if (mavenFilteringHints != null) {
		for (String hint : mavenFilteringHints) {
			try {
				mavenFilteringComponents.add((MavenResourcesFiltering) plexusContainer
						.lookup(MavenResourcesFiltering.class.getName(), hint));
			} catch (ComponentLookupException e) {
				throw new MojoExecutionException(e.getMessage(), e);
			}
		}
	} else {
		getLog().debug("no use filter components");
	}

	if (mavenFilteringComponents != null && !mavenFilteringComponents.isEmpty()) {
		getLog().debug("execute user filters");
		for (MavenResourcesFiltering filter : mavenFilteringComponents) {
			filter.filterResources(mavenResourcesExecution);
		}
	}
}
 
开发者ID:dajester2013,项目名称:lucee-maven-plugin,代码行数:24,代码来源:LarCopySourcesMojo.java

示例2: filterAndCopy

import org.apache.maven.shared.filtering.MavenResourcesFiltering; //导入方法依赖的package包/类
private static void filterAndCopy(AbstractWisdomMojo mojo, MavenResourcesFiltering filtering, File in, File out) throws IOException {
    Resource resource = new Resource();
    resource.setDirectory(in.getAbsolutePath());
    resource.setFiltering(true);
    resource.setTargetPath(out.getAbsolutePath());

    List<String> excludedExtensions = new ArrayList<>();
    excludedExtensions.addAll(filtering.getDefaultNonFilteredFileExtensions());
    excludedExtensions.addAll(NON_FILTERED_EXTENSIONS);

    MavenResourcesExecution exec = new MavenResourcesExecution(ImmutableList.of(resource), out, mojo.project,
            "UTF-8", Collections.<String>emptyList(), excludedExtensions, mojo.session);
    exec.setEscapeString("\\");

    try {
        filtering.filterResources(exec);
    } catch (MavenFilteringException e) {
        throw new IOException("Error while copying resources", e);
    }
}
 
开发者ID:wisdom-framework,项目名称:wisdom,代码行数:21,代码来源:ResourceCopy.java

示例3: executeUserFilterComponents

import org.apache.maven.shared.filtering.MavenResourcesFiltering; //导入方法依赖的package包/类
/**
 * @param mavenResourcesExecution {@link MavenResourcesExecution}
 * @throws MojoExecutionException  in case of wrong lookup.
 * @throws MavenFilteringException in case of failure.
 * @since 2.5
 */
protected void executeUserFilterComponents(MavenResourcesExecution mavenResourcesExecution)
        throws MojoExecutionException, MavenFilteringException {

    if (mavenFilteringHints != null) {
        for (String hint : mavenFilteringHints) {
            try {
                // CHECKSTYLE_OFF: LineLength
                mavenFilteringComponents.add((MavenResourcesFiltering) plexusContainer.lookup(MavenResourcesFiltering.class.getName(), hint));
                // CHECKSTYLE_ON: LineLength
            } catch (ComponentLookupException e) {
                throw new MojoExecutionException(e.getMessage(), e);
            }
        }
    } else {
        getLog().debug("no use filter components");
    }

    if (mavenFilteringComponents != null && !mavenFilteringComponents.isEmpty()) {
        getLog().debug("execute user filters");
        for (MavenResourcesFiltering filter : mavenFilteringComponents) {
            filter.filterResources(mavenResourcesExecution);
        }
    }
}
 
开发者ID:walokra,项目名称:markdown-page-generator-plugin,代码行数:31,代码来源:MdPageGeneratorMojo.java

示例4: copyResources

import org.apache.maven.shared.filtering.MavenResourcesFiltering; //导入方法依赖的package包/类
/**
 * Copy resources to target directory using Maven resource filtering so that we don't have to handle
 * recursive directory listing and pattern matching.
 * In order to disable filtering, the "filtering" property is force set to False.
 *
 * @param project
 * @param session
 * @param filtering
 * @param resources
 * @param targetDirectory
 * @throws IOException
 */
public static void copyResources(final MavenProject project, final MavenSession session,
                                 final MavenResourcesFiltering filtering, final List<Resource> resources,
                                 final String targetDirectory) throws IOException {
    for (final Resource resource : resources) {
        resource.setTargetPath(Paths.get(targetDirectory, resource.getTargetPath()).toString());
        resource.setFiltering(false);
    }

    final MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution(
            resources,
            new File(targetDirectory),
            project,
            "UTF-8",
            null,
            Collections.EMPTY_LIST,
            session
    );

    // Configure executor
    mavenResourcesExecution.setEscapeWindowsPaths(true);
    mavenResourcesExecution.setInjectProjectBuildFilters(false);
    mavenResourcesExecution.setOverwrite(true);
    mavenResourcesExecution.setIncludeEmptyDirs(false);
    mavenResourcesExecution.setSupportMultiLineFiltering(false);

    // Filter resources
    try {
        filtering.filterResources(mavenResourcesExecution);
    } catch (MavenFilteringException ex) {
        throw new IOException("Failed to copy resources", ex);
    }
}
 
开发者ID:Microsoft,项目名称:azure-maven-plugins,代码行数:45,代码来源:Utils.java

示例5: copyFileToDir

import org.apache.maven.shared.filtering.MavenResourcesFiltering; //导入方法依赖的package包/类
/**
 * Copies the file <tt>file</tt> to the directory <tt>dir</tt>, keeping the structure relative to <tt>rel</tt>.
 *
 * @param file                 the file to copy
 * @param rel                  the base 'relative'
 * @param dir                  the directory
 * @param mojo                 the mojo
 * @param filtering            the filtering component
 * @param additionalProperties additional properties
 * @throws IOException if the file cannot be copied.
 */
public static void copyFileToDir(File file, File rel, File dir, AbstractWisdomMojo mojo, MavenResourcesFiltering
        filtering, Properties additionalProperties) throws
        IOException {
    if (filtering == null) {
        File out = computeRelativeFile(file, rel, dir);
        if (out.getParentFile() != null) {
            mojo.getLog().debug("Creating " + out.getParentFile() + " : " + out.getParentFile().mkdirs());
            FileUtils.copyFileToDirectory(file, out.getParentFile());
        } else {
            throw new IOException("Cannot copy file - parent directory not accessible for "
                    + file.getAbsolutePath());
        }
    } else {
        Resource resource = new Resource();
        resource.setDirectory(rel.getAbsolutePath());
        resource.setFiltering(true);
        resource.setTargetPath(dir.getAbsolutePath());
        resource.setIncludes(ImmutableList.of("**/" + file.getName()));

        List<String> excludedExtensions = new ArrayList<>();
        excludedExtensions.addAll(filtering.getDefaultNonFilteredFileExtensions());
        excludedExtensions.addAll(NON_FILTERED_EXTENSIONS);

        MavenResourcesExecution exec = new MavenResourcesExecution(ImmutableList.of(resource), dir, mojo.project,
                "UTF-8", Collections.<String>emptyList(), excludedExtensions, mojo.session);

        if (additionalProperties != null) {
            exec.setAdditionalProperties(additionalProperties);
        }
        exec.setEscapeString("\\");

        try {
            filtering.filterResources(exec);
        } catch (MavenFilteringException e) {
            throw new IOException("Error while copying resources", e);
        }
    }
}
 
开发者ID:wisdom-framework,项目名称:wisdom,代码行数:50,代码来源:ResourceCopy.java


注:本文中的org.apache.maven.shared.filtering.MavenResourcesFiltering.filterResources方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。