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


Java Resource.addInclude方法代码示例

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


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

示例1: setupMavenPaths

import org.apache.maven.model.Resource; //导入方法依赖的package包/类
/**
 * Updates XJC's compilePath ans resources and update hyperjaxb2's
 * resources, that is, *.hbm.xml files and hibernate.config.xml file.
 * 
 * @param xjcOpts
 * @throws MojoExecutionException
 */
protected void setupMavenPaths() {
	super.setupMavenPaths();

	final Resource resource = new Resource();
	resource.setDirectory(getGenerateDirectory().getPath());
	for (String resourceInclude : resourceIncludes) {
		resource.addInclude(resourceInclude);
	}
	getProject().addResource(resource);

	if (this.roundtripTestClassName != null) {
		getProject().addTestCompileSourceRoot(
				getGenerateDirectory().getPath());
	}
}
 
开发者ID:highsource,项目名称:hyperjaxb3,代码行数:23,代码来源:Hyperjaxb3Mojo.java

示例2: addNonPartialsToResources

import org.apache.maven.model.Resource; //导入方法依赖的package包/类
private void addNonPartialsToResources(final File dir, final Resource resource) throws CodeGenException {
    if (dir.equals(null)) {
        throw new CodeGenException("Could not read from directory " + dir.getPath());
    }
    final File[] files = dir.listFiles();
    if (files == null) {
        return;
    }
    for(File entry : files) {
        try {
            if (entry.isDirectory()) {
                addNonPartialsToResources(entry, resource);
            } else if (entry.getName().endsWith(".json") && ProctorUtils.readJsonFromFile(entry).has("tests")) {
                resource.addInclude(entry.getPath().substring(getTopDirectory().getPath().length() + 1));
            }
        } catch (IOException e) {
            throw new CodeGenException("Could not read from file " + entry.getName(),e);
        }

    }
}
 
开发者ID:indeedeng,项目名称:proctor,代码行数:22,代码来源:AbstractProctorMojo.java

示例3: getResources

import org.apache.maven.model.Resource; //导入方法依赖的package包/类
Resource[] getResources() throws MojoExecutionException {
    final Resource resourceNonGenerated = new Resource();
    resourceNonGenerated.setDirectory(getTopDirectory().getPath());
    try {
        addNonPartialsToResources(getTopDirectory(),resourceNonGenerated);
    } catch (CodeGenException e) {
        throw new MojoExecutionException("Couldn't add non partial specifications to resources");
    }
    if (resourceNonGenerated.getIncludes().isEmpty()) {
        resourceNonGenerated.addExclude("**/*");
    }
    Resource resourceGenerated = new Resource();
    final File specificationOutputDir = getSpecificationOutput();
    resourceGenerated.setDirectory(specificationOutputDir.getPath());
    resourceGenerated.addInclude("**/*.json");
    final Resource[] resources = {resourceNonGenerated,resourceGenerated};
    return resources;

}
 
开发者ID:indeedeng,项目名称:proctor,代码行数:20,代码来源:AbstractProctorMojo.java

示例4: addCommonRackApplicationResources

import org.apache.maven.model.Resource; //导入方法依赖的package包/类
private void addCommonRackApplicationResources() {
    Resource resource = new Resource();
    resource.setDirectory(getProject().getBasedir().getAbsolutePath());
    resource.addInclude("config.ru");
    getProject().addResource(resource);
    createAndAddResource(new File(getProject().getBasedir(), "lib"));
    createAndAddResource(new File(getProject().getBasedir(), "app"));
    createAndAddResource(new File(getProject().getBasedir(), "public"));
    createAndAddResource(new File(getProject().getBasedir(), "config"));
}
 
开发者ID:torquebox,项目名称:jruby9-maven-plugins,代码行数:11,代码来源:WarMojo.java

示例5: createGemsResource

import org.apache.maven.model.Resource; //导入方法依赖的package包/类
protected Resource createGemsResource(String gemHome) {
    Resource resource = new Resource();
    resource.setDirectory(gemHome);
    resource.addInclude("bin/*");
    resource.addInclude("specifications/*");
    resource.addInclude("gems/**");
    resource.addExclude("gems/*/test/**");
    resource.addExclude("gems/*/tests/**");
    resource.addExclude("gems/*/spec/**");
    resource.addExclude("gems/*/specs/**");
    resource.addExclude("gems/*/features/**");
    resource.addExclude("gems/**/*.java");
    return resource;
}
 
开发者ID:torquebox,项目名称:jruby9-maven-plugins,代码行数:15,代码来源:AbstractGenerateMojo.java

示例6: includeConfigurationFile

import org.apache.maven.model.Resource; //导入方法依赖的package包/类
/**
 * <p>todo: javadocs</p>
 *
 * @param testResources
 */
private void includeConfigurationFile(final List<Resource> testResources) {

    for (final Resource rawResource : testResources) {

        if (rawResource.getDirectory() != null) {

            rawResource.addInclude(configurationFileName);
        }
    }
}
 
开发者ID:AndyScherzinger,项目名称:architecturerules,代码行数:16,代码来源:ArchitectureRulesMojo.java

示例7: setupMavenPaths

import org.apache.maven.model.Resource; //导入方法依赖的package包/类
/**
 * Augments Maven paths with generated resources.
 */
protected void setupMavenPaths() {

	if (getAddCompileSourceRoot()) {
		getProject().addCompileSourceRoot(getGenerateDirectory().getPath());
	}
	if (getAddTestCompileSourceRoot()) {
		getProject().addTestCompileSourceRoot(getGenerateDirectory().getPath());
	}
	if (getEpisode() && getEpisodeFile() != null) {
		final String episodeFilePath = getEpisodeFile().getAbsolutePath();
		final String generatedDirectoryPath = getGenerateDirectory().getAbsolutePath();

		if (episodeFilePath.startsWith(generatedDirectoryPath + File.separator)) {
			final String path = episodeFilePath.substring(generatedDirectoryPath.length() + 1);

			final Resource resource = new Resource();
			resource.setDirectory(generatedDirectoryPath);
			resource.addInclude(path);
			if (getAddCompileSourceRoot()) {
				getProject().addResource(resource);
			}
			if (getAddTestCompileSourceRoot()) {
				getProject().addTestResource(resource);

			}
		}
	}
}
 
开发者ID:highsource,项目名称:maven-jaxb2-plugin,代码行数:32,代码来源:RawXJC2Mojo.java

示例8: execute

import org.apache.maven.model.Resource; //导入方法依赖的package包/类
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
    ArtifactHelper helper = new ArtifactHelper(unzip, system,
            localRepository, getProject().getRemoteArtifactRepositories());
    File jrubyWar = new File(getProject().getBuild().getDirectory(), "jrubyWar");
    File jrubyWarLib = new File(jrubyWar, "lib");
    File webXml = new File(jrubyWar, "web.xml");
    File initRb = new File(jrubyWar, "init.rb");
    File jrubyWarClasses = new File(jrubyWar, "classes");
    
    switch(type) {
    case jetty:
        helper.unzip(jrubyWarClasses, "org.eclipse.jetty", "jetty-server", jettyVersion);
        helper.unzip(jrubyWarClasses, "org.eclipse.jetty", "jetty-webapp", jettyVersion);
        if (mainClass == null ) mainClass = "org.jruby.mains.JettyRunMain";
    case runnable:
        helper.unzip(jrubyWarClasses, "org.jruby.mains", "jruby-mains", jrubyMainsVersion);
        if (mainClass == null ) mainClass = "org.jruby.mains.WarMain";
        
        MavenArchiveConfiguration archive = getArchive();
        archive.getManifest().setMainClass(mainClass);
        
        createAndAddWebResource(jrubyWarClasses, "");
        createAndAddWebResource(new File(getProject().getBuild().getOutputDirectory(), "bin"), "bin");
    case archive:
    default:
    }
    
    helper.copy(jrubyWarLib, "org.jruby", "jruby-complete", jrubyVersion);
    helper.copy(jrubyWarLib, "org.jruby.rack", "jruby-rack", jrubyRackVersion,
            "org.jruby:jruby-complete"); //exclude jruby-complete

    // we bundle jar dependencies the ruby way
    getProject().getArtifacts().clear();

    createAndAddWebResource(jrubyWarLib, "WEB-INF/lib");

    copyPluginResource(initRb);
    Resource resource = new Resource();
    resource.setDirectory(initRb.getParent());
    resource.addInclude(initRb.getName());
    resource.setTargetPath("META-INF");
    addWebResource(resource);

    if (defaultResource) {
        addCommonRackApplicationResources();
    }

    if (getWebXml() == null) {
        findWebXmlOrUseBuiltin(webXml);
    }

    super.execute();
}
 
开发者ID:torquebox,项目名称:jruby9-maven-plugins,代码行数:55,代码来源:WarMojo.java

示例9: execute

import org.apache.maven.model.Resource; //导入方法依赖的package包/类
/**
 * Performs the rasterization.
 *
 * @throws MojoExecutionException
 *             thrown when there is a problem executing Mjo.
 */
@Override
public void execute() throws MojoExecutionException {
    final SVGConverter converter = new SVGConverter(new LoggingSvgConverterController(getLog(), failOnError));
    converter.setDestinationType(mapMimeTypeToDestinationType(mimeType));

    final List<String> unfilteredSourceFiles = new LinkedList<String>();
    final List<String> filteredSourceFiles = new LinkedList<String>();
    if (svgResources == null) {
        final Resource defaultSvgResource = new Resource();
        defaultSvgResource.setDirectory(new File(project.getBasedir(), "src/main/svg").getPath());
        defaultSvgResource.addInclude("**/*.svg");
        defaultSvgResource.setFiltering(false);
        svgResources = Collections.singletonList(defaultSvgResource);
    }
    for (final Resource resource : svgResources) {
        final File basedirectory = new File(resource.getDirectory()); // NOPMD
        if (!basedirectory.isDirectory()) { // NOPMD
            getLog().warn(format(R.getString("missingdir"), resource.getDirectory()));
            continue;
        }
        final Scanner scanner = buildContext.newScanner(basedirectory);
        scanner.setIncludes(resource.getIncludes().toArray(new String[0])); // NOPMD
        scanner.setExcludes(resource.getExcludes().toArray(new String[0])); // NOPMD
        scanner.scan();
        for (final String includedFile : scanner.getIncludedFiles()) {
            if (resource.isFiltering()) {
                // TODO write out filtered file to batik folder and use the
                // filtered file as input.
                filteredSourceFiles.add(new File(basedirectory, // NOPMD
                        includedFile).toString());
            } else {
                unfilteredSourceFiles.add(new File(basedirectory, // NOPMD
                        includedFile).toString());
            }
        }
    }
    converter.setDst(destDir);
    converter.setWidth(width);
    converter.setHeight(height);
    converter.setMaxWidth(maxWidth);
    converter.setMaxHeight(maxHeight);
    try {
        if (!filteredSourceFiles.isEmpty()) {
            converter.setSources(filteredSourceFiles.toArray(new String[0]));
            converter.execute();
        }
        if (!unfilteredSourceFiles.isEmpty()) {
            converter.setSources(unfilteredSourceFiles.toArray(new String[0]));
            converter.execute();
        }
    } catch (final SVGConverterException e) {
        throw new MojoExecutionException(R.getString("errorduringconversion"), e);
    }
}
 
开发者ID:trajano,项目名称:batik-maven-plugin,代码行数:61,代码来源:RasterizerMojo.java


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