protected void filter(File sourceFile, File targetFile) throws MojoExecutionException { try { if (StringUtils.isEmpty(encoding)) { getLog().warn( "File encoding has not been set, using platform encoding " + ReaderFactory.FILE_ENCODING + ", i.e. build is platform dependent!"); } targetFile.getParentFile().mkdirs(); final MavenResourcesExecution mre = new MavenResourcesExecution(); mre.setMavenProject(project); mre.setMavenSession(mavenSession); mre.setFilters(null); mre.setEscapedBackslashesInFilePath(true); final LinkedHashSet<String> delimiters = new LinkedHashSet<>(); delimiters.add("${*}"); mre.setDelimiters(delimiters); @SuppressWarnings("rawtypes") List filters = mavenFileFilter.getDefaultFilterWrappers(mre); mavenFileFilter.copyFile(sourceFile, targetFile, true, filters, encoding, true); } catch (MavenFilteringException e) { throw new MojoExecutionException(e.getMessage(), e); } }
protected void filter(File sourceFile, File targetFile) throws MojoExecutionException { try { if (StringUtils.isEmpty(encoding)) { getLog().warn( "File encoding has not been set, using platform encoding " + ReaderFactory.FILE_ENCODING + ", i.e. build is platform dependent!"); } targetFile.getParentFile().mkdirs(); final MavenResourcesExecution mre = new MavenResourcesExecution(); mre.setMavenProject(project); mre.setMavenSession(mavenSession); mre.setFilters(null); mre.setEscapedBackslashesInFilePath(true); final LinkedHashSet<String> delimiters = new LinkedHashSet<>(); delimiters.add("${*}"); mre.setDelimiters(delimiters); @SuppressWarnings("rawtypes") List filters = mavenFileFilter.getDefaultFilterWrappers(mre); mavenFileFilter.copyFile(sourceFile, targetFile, true, filters, encoding, true); } catch (MavenFilteringException e) { throw new MojoExecutionException(e.getMessage(), e); } }
@Nonnull public List<FileUtils.FilterWrapper> getDefaultFilterWrappers( final MavenProject mavenProject, List<String> filters, final boolean escapedBackslashesInFilePath, MavenSession mavenSession, MavenResourcesExecution mavenResourcesExecution ) throws MavenFilteringException { MavenResourcesExecution mre = mavenResourcesExecution == null ? new MavenResourcesExecution() : mavenResourcesExecution.copyOf(); mre.setMavenProject( mavenProject ); mre.setMavenSession( mavenSession ); mre.setFilters( filters ); mre.setEscapedBackslashesInFilePath( escapedBackslashesInFilePath ); return getDefaultFilterWrappers( mre ); }
mavenResourcesExecution.setFilters( filters ); mavenResourcesExecution.setEscapedBackslashesInFilePath( escapedBackslashesInFilePath ); mavenResourcesExecution.setMavenSession( this.session );