當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。