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


Java MavenResourcesFiltering类代码示例

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


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

示例1: doExecute

import org.apache.maven.shared.filtering.MavenResourcesFiltering; //导入依赖的package包/类
@Test
public void doExecute() throws Exception {
    final PackageMojo mojo = getMojoFromPom();
    final PackageMojo mojoSpy = spy(mojo);
    ReflectionUtils.setVariableValueInObject(mojoSpy, "finalName", "artifact-0.1.0");
    doReturn(mock(AnnotationHandler.class)).when(mojoSpy).getAnnotationHandler();
    doReturn(ClasspathHelper.forPackage("com.microsoft.azure.maven.function.handlers").toArray()[0])
            .when(mojoSpy)
            .getTargetClassUrl();
    doReturn("target/azure-functions").when(mojoSpy).getDeploymentStageDirectory();
    doReturn("target").when(mojoSpy).getBuildDirectoryAbsolutePath();
    doReturn(mock(MavenProject.class)).when(mojoSpy).getProject();
    doReturn(mock(MavenSession.class)).when(mojoSpy).getSession();
    doReturn(mock(MavenResourcesFiltering.class)).when(mojoSpy).getMavenResourcesFiltering();

    mojoSpy.doExecute();
}
 
开发者ID:Microsoft,项目名称:azure-maven-plugins,代码行数:18,代码来源:PackageMojoTest.java

示例2: 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

示例3: testBadDirectoryDoesNotAddSourceFolder

import org.apache.maven.shared.filtering.MavenResourcesFiltering; //导入依赖的package包/类
@Test
public void testBadDirectoryDoesNotAddSourceFolder()
    throws MojoExecutionException, MavenFilteringException
{
    FilterSourcesMojo filterSourcesMojo = new FilterSourcesMojo()
    {
        @Override
        protected void addSourceFolderToProject( MavenProject mavenProject )
        {
            throw new IllegalArgumentException();
        }
    };
    filterSourcesMojo.sourceDirectory = failingParam;

    MavenResourcesFiltering mock = mock( MavenResourcesFiltering.class );
    filterSourcesMojo.mavenResourcesFiltering = mock;

    filterSourcesMojo.execute();
    verifyZeroInteractions( mock );
}
 
开发者ID:mojohaus,项目名称:templating-maven-plugin,代码行数:21,代码来源:FailingFilterSourcesMojoTest.java

示例4: copyConfiguration

import org.apache.maven.shared.filtering.MavenResourcesFiltering; //导入依赖的package包/类
/**
 * Copies the configuration from "src/main/configuration" to "wisdom/conf". Copied resources are filtered.
 *
 * @param mojo      the mojo
 * @param filtering the component required to filter resources
 * @throws IOException if a file cannot be copied
 */
public static void copyConfiguration(AbstractWisdomWatcherMojo mojo, MavenResourcesFiltering filtering) throws
        IOException {
    File in = new File(mojo.basedir, Constants.CONFIGURATION_SRC_DIR);
    if (in.isDirectory()) {
        File out = new File(mojo.getWisdomRootDirectory(), Constants.CONFIGURATION_DIR);
        filterAndCopy(mojo, filtering, in, out);
    } else {
        mojo.getLog().warn("No configuration directory (src/main/configuration) - use this mode at your own risk");
        mojo.getLog().warn("A fake application configuration is going to be created, " +
                "using a fake application secret, do not use this file in production");
        // No configuration directory, generate a fake application configuration
        File conf = new File(mojo.getWisdomRootDirectory(), "conf");
        mojo.getLog().debug("Creating conf directory " + conf.mkdirs());
        File output = new File(conf, "application.conf");
        ApplicationSecretGenerator.generateFakeConfiguration(output);
    }
}
 
开发者ID:wisdom-framework,项目名称:wisdom,代码行数:25,代码来源:ResourceCopy.java

示例5: 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

示例6: 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

示例7: copyResourcesToStageDirectory

import org.apache.maven.shared.filtering.MavenResourcesFiltering; //导入依赖的package包/类
@Test
public void copyResourcesToStageDirectory() throws Exception {
    doReturn(mock(MavenProject.class)).when(mojo).getProject();
    doReturn(mock(MavenSession.class)).when(mojo).getSession();
    doReturn(mock(MavenResourcesFiltering.class)).when(mojo).getMavenResourcesFiltering();
    doReturn("stageDirectory").when(mojo).getDeploymentStageDirectory();

    handler.copyResourcesToStageDirectory(new ArrayList<Resource>());
    verify(mojo, times(1)).getProject();
    verify(mojo, times(1)).getSession();
    verify(mojo, times(1)).getMavenResourcesFiltering();
    verify(mojo, times(1)).getDeploymentStageDirectory();
    verifyNoMoreInteractions(mojo);
}
 
开发者ID:Microsoft,项目名称:azure-maven-plugins,代码行数:15,代码来源:FTPArtifactHandlerImplTest.java

示例8: 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

示例9: copyResources

import org.apache.maven.shared.filtering.MavenResourcesFiltering; //导入依赖的package包/类
@Test
public void copyResources() throws Exception {
    final MavenResourcesFiltering filtering = mock(MavenResourcesFiltering.class);
    final Resource resource = new Resource();
    resource.setTargetPath("/");

    Utils.copyResources(mock(MavenProject.class),
            mock(MavenSession.class),
            filtering,
            Arrays.asList(new Resource[] {resource}),
            "target");
    verify(filtering, times(1)).filterResources(any(MavenResourcesExecution.class));
    verifyNoMoreInteractions(filtering);
}
 
开发者ID:Microsoft,项目名称:azure-maven-plugins,代码行数:15,代码来源:UtilsTest.java

示例10: 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

示例11: copyExternalAssets

import org.apache.maven.shared.filtering.MavenResourcesFiltering; //导入依赖的package包/类
/**
 * Copies the external assets from "src/main/assets" to "wisdom/assets". Copied resources are filtered.
 *
 * @param mojo      the mojo
 * @param filtering the component required to filter resources
 * @throws IOException if a file cannot be copied
 */
public static void copyExternalAssets(AbstractWisdomMojo mojo, MavenResourcesFiltering filtering) throws IOException {
    File in = new File(mojo.basedir, Constants.ASSETS_SRC_DIR);
    if (!in.exists()) {
        return;
    }
    File out = new File(mojo.getWisdomRootDirectory(), Constants.ASSETS_DIR);
    filterAndCopy(mojo, filtering, in, out);
}
 
开发者ID:wisdom-framework,项目名称:wisdom,代码行数:16,代码来源:ResourceCopy.java

示例12: copyTemplates

import org.apache.maven.shared.filtering.MavenResourcesFiltering; //导入依赖的package包/类
/**
 * Copies the external templates from "src/main/templates" to "wisdom/templates". Copied resources are filtered.
 *
 * @param mojo      the mojo
 * @param filtering the component required to filter resources
 * @throws IOException if a file cannot be copied
 */
public static void copyTemplates(AbstractWisdomMojo mojo, MavenResourcesFiltering filtering) throws IOException {
    File in = new File(mojo.basedir, Constants.TEMPLATES_SRC_DIR);
    if (!in.exists()) {
        return;
    }
    File out = new File(mojo.getWisdomRootDirectory(), Constants.TEMPLATES_DIR);

    filterAndCopy(mojo, filtering, in, out);
}
 
开发者ID:wisdom-framework,项目名称:wisdom,代码行数:17,代码来源:ResourceCopy.java

示例13: copyInternalResources

import org.apache.maven.shared.filtering.MavenResourcesFiltering; //导入依赖的package包/类
/**
 * Copies the internal resources from "src/main/resources" to "target/classes". Copied resources are filtered.
 * Notice that these resources are embedded in the application's bundle.
 *
 * @param mojo      the mojo
 * @param filtering the component required to filter resources
 * @throws IOException if a file cannot be copied
 */
public static void copyInternalResources(AbstractWisdomMojo mojo, MavenResourcesFiltering filtering) throws
        IOException {
    File in = new File(mojo.basedir, Constants.MAIN_RESOURCES_DIR);
    if (!in.exists()) {
        return;
    }
    File out = new File(mojo.buildDirectory, "classes");
    filterAndCopy(mojo, filtering, in, out);
}
 
开发者ID:wisdom-framework,项目名称:wisdom,代码行数:18,代码来源:ResourceCopy.java

示例14: copyInstances

import org.apache.maven.shared.filtering.MavenResourcesFiltering; //导入依赖的package包/类
/**
 * Copies the `cfg` files from `src/main/instances` to the Wisdom application directory.
 *
 * @param mojo      the mojo
 * @param filtering the filtering support
 * @throws IOException if file cannot be copied
 */
public static void copyInstances(AbstractWisdomMojo mojo, MavenResourcesFiltering filtering) throws IOException {
    File in = new File(mojo.basedir, Constants.INSTANCES_SRC_DIR);
    if (in.isDirectory()) {
        File out = new File(mojo.getWisdomRootDirectory(), Constants.APPLICATION_DIR);
        filterAndCopy(mojo, filtering, in, out);
    }
}
 
开发者ID:wisdom-framework,项目名称:wisdom,代码行数:15,代码来源:ResourceCopy.java

示例15: getMavenResourcesFiltering

import org.apache.maven.shared.filtering.MavenResourcesFiltering; //导入依赖的package包/类
public MavenResourcesFiltering getMavenResourcesFiltering() {
    return mavenResourcesFiltering;
}
 
开发者ID:Microsoft,项目名称:azure-maven-plugins,代码行数:4,代码来源:AbstractAzureMojo.java


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