protected void mergeResource_TargetPath( Resource target, Resource source, boolean sourceDominant, Map<Object, Object> context ) { String src = source.getTargetPath(); if ( src != null ) { if ( sourceDominant || target.getTargetPath() == null ) { target.setTargetPath( src ); target.setLocation( "targetPath", source.getLocation( "targetPath" ) ); } } }
originalResource.setTargetPath( pathTranslator.unalignFromBaseDirectory( target, project.getBasedir() ) );
public ResourceBuilder targetPath(String targetPath) { if (targetPath != null) { resource.setTargetPath(targetPath); } return this; }
public static Resource cloneResource( Resource src ) { Resource result = null; if ( src != null ) { result = new Resource(); result.setDirectory( src.getDirectory() ); result.setExcludes( cloneListOfStrings( src.getExcludes() ) ); result.setFiltering( src.isFiltering() ); result.setIncludes( cloneListOfStrings( src.getIncludes() ) ); result.setMergeId( src.getMergeId() ); result.setTargetPath( src.getTargetPath() ); } return result; }
resource.setTargetPath( interpolatedTrimmed( parser.nextText(), "targetPath" ) );
resource.setTargetPath( interpolatedTrimmed( parser.nextText(), "targetPath" ) );
public Resource getResource() { Resource resource = new Resource(); if (targetPath != null) { resource.setTargetPath(targetPath); } resource.setFiltering(filtering); if (directory != null) { resource.setDirectory(directory); } if (includes != null) { resource.setIncludes(Arrays.asList(includes.split(","))); } if (excludes != null) { resource.setExcludes(Arrays.asList(excludes.split(","))); } return resource; } }
public default Resource resource(String directory, String targetPath, boolean filtering, List<String> includes, List<String> excludes) { Resource resource = new Resource(); resource.setDirectory(directory); if (targetPath != null) { resource.setTargetPath(targetPath); } resource.setFiltering(filtering); if (includes != null) { resource.setIncludes(includes); } if (excludes != null) { resource.setExcludes(excludes); } return resource; }
resource.setTargetPath( getTrimmedValue( value ) );
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); } }
@Override public 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); }
protected void mergeResource_TargetPath( Resource target, Resource source, boolean sourceDominant, Map<Object, Object> context ) { String src = source.getTargetPath(); if ( src != null ) { if ( sourceDominant || target.getTargetPath() == null ) { target.setTargetPath( src ); target.setLocation( "targetPath", source.getLocation( "targetPath" ) ); } } }
resource.setDirectory( configurationSourceDirectory.getAbsolutePath() ); resource.setFiltering( filterConfigurationDirectory ); resource.setTargetPath( configurationDirectory ); List<Resource> resources = new ArrayList<Resource>(); resources.add( resource );
resource.setDirectory( configurationSourceDirectory.getAbsolutePath() ); resource.setFiltering( filterConfigurationDirectory ); resource.setTargetPath( configurationDirectory ); List<Resource> resources = new ArrayList<Resource>(); resources.add( resource );
@Override public void execute() throws MojoExecutionException { for (String superSourceRoot : SourcesAsResourcesHelper.filterSourceRoots( getLog(), getProjectResources(), Collections.singleton(getSuperSourceRoot()))) { Resource resource = new Resource(); resource.setDirectory(superSourceRoot); if (isSuperSourceRelocated()) { if (StringUtils.isBlank(moduleName)) { throw new MojoExecutionException("Cannot relocate super-sources if moduleName is not specified"); } String targetPath = moduleName.replace('.', '/'); // Keep only package name targetPath = targetPath.substring(0, targetPath.lastIndexOf('/')); // Relocate into 'super' subfolder targetPath = SourcesAsResourcesHelper.ensureTrailingSlash(targetPath) + "super/"; resource.setTargetPath(targetPath); } addResource(resource); } }
private List translateResources( List v3Resources ) { List resources = new ArrayList(); if ( notEmpty( v3Resources ) ) { for ( Iterator it = v3Resources.iterator(); it.hasNext(); ) { org.apache.maven.model.v3_0_0.Resource v3Resource = (org.apache.maven.model.v3_0_0.Resource) it.next(); Resource resource = new Resource(); if ( v3Resource.getDirectory() == null ) { resource.setDirectory( "." ); } else { resource.setDirectory( v3Resource.getDirectory() ); } List excludes = new ArrayList( v3Resource.getExcludes() ); resource.setExcludes( excludes ); resource.setIncludes( v3Resource.getIncludes() ); resource.setTargetPath( v3Resource.getTargetPath() ); resources.add( resource ); } } return resources; }
@Override protected void executeWithGems() throws MojoExecutionException, ScriptException, IOException, GemException { if ( includeRubyResources != null) { // add it to the classpath so java classes can find the ruby files Resource resource = new Resource(); resource.setDirectory(project.getBasedir().getAbsolutePath()); for( String include: includeRubyResources) { resource.addInclude(include); } if (excludeRubyResources != null) { for( String exclude: excludeRubyResources) { resource.addExclude(exclude); } } addResource(project.getBuild().getResources(), resource); } if (includeBinStubs) { Resource resource = new Resource(); resource.setDirectory(gemsConfig.getBinDirectory().getAbsolutePath()); resource.addInclude("*"); resource.setTargetPath("META-INF/jruby.home/bin"); addResource(project.getBuild().getResources(), resource); } } }
apiGen.generate(); Resource schemaResource = new Resource(); schemaResource.setTargetPath("graphql-apigen-schema"); schemaResource.setFiltering(false); schemaResource.setIncludes(Arrays.asList("*.graphqls","*.graphql"));
@Override protected void executeWithGems() throws MojoExecutionException, ScriptException, IOException, GemException { if ( includeRubyResources != null) { // add it to the classpath so java classes can find the ruby files Resource resource = new Resource(); resource.setDirectory(project.getBasedir().getAbsolutePath()); for( String include: includeRubyResources) { resource.addInclude(include); } if (excludeRubyResources != null) { for( String exclude: excludeRubyResources) { resource.addExclude(exclude); } } addResource(project.getBuild().getResources(), resource); } if (includeBinStubs) { Resource resource = new Resource(); resource.setDirectory(gemsConfig.getBinDirectory().getAbsolutePath()); resource.addInclude("*"); resource.setTargetPath("META-INF/jruby.home/bin"); addResource(project.getBuild().getResources(), resource); } } }
public void filterResource(String directory, String include, String targetPath, File outputDirectory) { Resource resource = new Resource(); resource.setDirectory(directory); resource.addInclude(include); resource.setFiltering(true); resource.setTargetPath(targetPath); MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution( Collections.singletonList(resource), outputDirectory, project, encoding, filters, defaultNonFilteredFileExtensions, session); System.out.println("mavenResourcesExecution: " + mavenResourcesExecution); mavenResourcesExecution.setInjectProjectBuildFilters(false); mavenResourcesExecution.setOverwrite(true); mavenResourcesExecution.setSupportMultiLineFiltering(true); try { mavenResourcesFiltering.filterResources(mavenResourcesExecution); } catch (MavenFilteringException e) { e.printStackTrace(); } }