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


Java Resource.setIncludes方法代码示例

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


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

示例1: getResources

import org.apache.maven.model.Resource; //导入方法依赖的package包/类
protected List<Resource> getResources() {
    final Resource resource = new Resource();
    resource.setDirectory(getBuildDirectoryAbsolutePath());
    resource.setTargetPath("/");
    resource.setFiltering(false);
    resource.setIncludes(Arrays.asList("*.jar"));
    return Arrays.asList(resource);
}
 
开发者ID:Microsoft,项目名称:azure-maven-plugins,代码行数:9,代码来源:PackageMojo.java

示例2: execute

import org.apache.maven.model.Resource; //导入方法依赖的package包/类
@Override
public void execute() {
    try {
        sourceDirectory = makeAbsolute(sourceDirectory);
        outputDirectory = makeAbsolute(outputDirectory);
        if ( ! sourceDirectory.exists() ) return;
        getLog().debug("Running ApiGen\n\tsourceDirectory=" + sourceDirectory +
                       "\n\toutputDirectory=" + outputDirectory);
        ClassLoader cp = getCompileClassLoader();
        ApiGen apiGen = new ApiGen.Builder()
            .withOutputDirectory(outputDirectory.toPath())
            .withGuiceModuleName(guiceModuleName)
            .withDefaultPackageName(defaultPackageName)
            .build();
        PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(cp);
        for ( org.springframework.core.io.Resource resource : resolver.getResources("classpath*:graphql-apigen-schema/*.graphql{,s}") ) {
            URL url = resource.getURL();
            getLog().debug("Processing "+url);
            apiGen.addForReference(url);
        }
        findGraphql(sourceDirectory, apiGen::addForGeneration);
        apiGen.generate();
        Resource schemaResource = new Resource();
        schemaResource.setTargetPath("graphql-apigen-schema");
        schemaResource.setFiltering(false);
        schemaResource.setIncludes(Arrays.asList("*.graphqls","*.graphql"));
        schemaResource.setDirectory(sourceDirectory.toString());
        project.addResource(schemaResource);
        project.addCompileSourceRoot(outputDirectory.getAbsolutePath());
    } catch (Exception e) {
        String msg = e.getMessage();
        if ( null == msg ) msg = e.getClass().getName();
        getLog().error(msg + " when trying to build sources from graphql.", e);
    }
}
 
开发者ID:Distelli,项目名称:graphql-apigen,代码行数:36,代码来源:ApiGenMojo.java

示例3: execute

import org.apache.maven.model.Resource; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void execute() throws MojoExecutionException {
	getLog().info("Writing plugin description file to " + outputDescriptionFile);
	try {

		PluginDescription description = new PluginDescription(new MavenArtifact(project.getArtifact()),
				((Set<Artifact>) project.getArtifacts()).stream()
						.filter(artifact -> Artifact.SCOPE_COMPILE.equals(artifact.getScope()))
						.filter(artifact -> !artifact.isOptional())
						.filter(artifact -> excludes == null || !excludes.contains(artifact.getGroupId() + ":" + artifact.getArtifactId()))
						.map(MavenArtifact::new)
						.collect(toSet()));

		File outputDescriptionFileParent = outputDescriptionFile.getParentFile();
		if (!outputDescriptionFileParent.exists()) {
			outputDescriptionFileParent.mkdirs();
		}

		try (Writer writer = new OutputStreamWriter(new BufferedOutputStream(buildContext.newFileOutputStream(outputDescriptionFile)), "UTF-8")) {
			gson.toJson(description, writer);
		}
		Resource resource = new Resource();
		resource.setDirectory(outputDescriptionFile.getParentFile().getAbsolutePath());
		resource.setIncludes(Arrays.asList(outputDescriptionFile.getName()));
		resource.setTargetPath(outputTarget);
		project.addResource(resource);
		File descriptionArtifact = new File(artifactOutputDir, project.getArtifactId() + "-" + project.getVersion() + "-lolixl-plugin.json");
		FileUtils.copyFile(outputDescriptionFile, descriptionArtifact);
		projectHelper.attachArtifact(project, "json", "lolixl-plugin", descriptionArtifact);
	} catch (IOException e) {
		throw new MojoExecutionException("Couldn't generate plugin description file", e);
	}
}
 
开发者ID:to2mbn,项目名称:LoliXL,代码行数:35,代码来源:GenerateDescriptionMojo.java

示例4: convertToMavenResource

import org.apache.maven.model.Resource; //导入方法依赖的package包/类
private static Resource convertToMavenResource(MavenResource mavenResource, File projectDir) {
  Resource resource = new Resource();
  resource.setDirectory(relativize(projectDir, mavenResource.getDirectory()));
  resource.setFiltering(mavenResource.isFiltered());
  resource.setTargetPath(mavenResource.getTargetPath());
  resource.setIncludes(mavenResource.getIncludes());
  resource.setExcludes(mavenResource.getExcludes());
  return resource;
}
 
开发者ID:eclipse,项目名称:che,代码行数:10,代码来源:MavenModelUtil.java

示例5: execute

import org.apache.maven.model.Resource; //导入方法依赖的package包/类
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
  getLog().info("Adding plugin manifest at " + manifestLocation + " as resource");

  Resource resource = new Resource();
  resource.setDirectory(manifestLocation.getParent());
  resource.setIncludes(Collections.singletonList(manifestLocation.getName()));
  resource.setTargetPath("META-INF");
  resource.setFiltering(true);
  project.addResource(resource);
}
 
开发者ID:Guidewire,项目名称:ijplugin-maven-plugin,代码行数:12,代码来源:ManifestMojo.java

示例6: addResource

import org.apache.maven.model.Resource; //导入方法依赖的package包/类
public void addResource( MavenProject project, String resourceDirectory, List<String> includes, List<String> excludes )
{
    Resource resource = new Resource();
    resource.setDirectory( resourceDirectory );
    resource.setIncludes( includes );
    resource.setExcludes( excludes );

    project.addResource( resource );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:10,代码来源:DefaultMavenProjectHelper.java

示例7: addTestResource

import org.apache.maven.model.Resource; //导入方法依赖的package包/类
public void addTestResource( MavenProject project, String resourceDirectory, List<String> includes, List<String> excludes )
{
    Resource resource = new Resource();
    resource.setDirectory( resourceDirectory );
    resource.setIncludes( includes );
    resource.setExcludes( excludes );

    project.addTestResource( resource );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:10,代码来源:DefaultMavenProjectHelper.java

示例8: copyFileToDir

import org.apache.maven.model.Resource; //导入方法依赖的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

示例9: filterResources

import org.apache.maven.model.Resource; //导入方法依赖的package包/类
protected void filterResources( File outputDirectory )
    throws MojoExecutionException
{

    Resource res = new Resource();
    // TODO: Check how to prevent hard coding here?
    res.setDirectory( getSourceDirectory().getAbsolutePath() );
    res.setFiltering( true );
    // TODO: Check if it makes sense to make this list configurable?
    res.setIncludes( Collections.singletonList( "**/*" ) );

    List<String> filtersFile = new ArrayList<String>();
    MavenResourcesExecution execution =
        new MavenResourcesExecution( Collections.singletonList( res ), outputDirectory, getMavenProject(),
                                     getEncoding(), filtersFile, getNonFilteredFileExtensions(),
                                     getMavenSession() );

    execution.setEscapeString( getEscapeString() );
    execution.setSupportMultiLineFiltering( isSupportMultiLineFiltering() );
    execution.setIncludeEmptyDirs( isIncludeEmptyDirs() );
    execution.setEscapeWindowsPaths( isEscapeWindowsPaths() );
    execution.setFilterFilenames( isFileNameFiltering() );
    //// execution.setFilters( filters );
    //
    // // TODO: Check if we need a parameter?
    execution.setOverwrite( true );
    execution.setDelimiters( getDelimiters(), isUseDefaultDelimiters() );
    execution.setEncoding( getEncoding() );
    //
    // execution.setUseDefaultFilterWrappers( true );

    if ( getNonFilteredFileExtensions() != null )
    {
        execution.setNonFilteredFileExtensions( getNonFilteredFileExtensions() );
    }

    try
    {
        mavenResourcesFiltering.filterResources( execution );
    }
    catch ( MavenFilteringException e )
    {
        getLog().error( "Failure during filtering.", e );
        throw new MojoExecutionException( "Failure during filtering", e );
    }

}
 
开发者ID:khmarbaise,项目名称:multienv-maven-plugin,代码行数:48,代码来源:AbstractMultiEnvMojo.java


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