/** * @throws MojoExecutionException */ private void setDefaultWrappers() throws MojoExecutionException { final MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution(); mavenResourcesExecution.setEscapeString( escapeString ); try { defaultFilterWrappers = mavenFileFilter.getDefaultFilterWrappers( project, filters, false, this.session, mavenResourcesExecution ); } catch ( MavenFilteringException e ) { getLog().error( "fail to build filering wrappers " + e.getMessage() ); throw new MojoExecutionException( e.getMessage(), e ); } }
throw new MavenFilteringException( "Error loading property file '" + filterFile + "'", e );
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(); } }
/** * @throws MojoExecutionException */ private void setDefaultWrappers() throws MojoExecutionException { final MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution(); mavenResourcesExecution.setEscapeString( escapeString ); try { defaultFilterWrappers = mavenFileFilter.getDefaultFilterWrappers( project, filters, false, this.session, mavenResourcesExecution ); } catch ( MavenFilteringException e ) { getLog().error( "fail to build filering wrappers " + e.getMessage() ); throw new MojoExecutionException( e.getMessage(), e ); } }
private String filterFileName( String name, List<FilterWrapper> wrappers ) throws MavenFilteringException { Reader reader = new StringReader( name ); for ( FilterWrapper wrapper : wrappers ) { reader = wrapper.getReader( reader ); } StringWriter writer = new StringWriter(); try { IOUtil.copy( reader, writer ); } catch ( IOException e ) { throw new MavenFilteringException( "Failed filtering filename" + name, e ); } String filteredFilename = writer.toString(); if ( getLogger().isDebugEnabled() ) { getLogger().debug( "renaming filename " + name + " to " + filteredFilename ); } return filteredFilename; }
private void copyNbmResources() throws MojoExecutionException { try { if ( StringUtils.isEmpty( encoding ) && isFilteringEnabled( nbmResources ) ) { getLog().warn( "File encoding has not been set, using platform encoding " + ReaderFactory.FILE_ENCODING + ", i.e. build is platform dependent!" ); } MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution( Arrays.asList( nbmResources ), clusterDir, project, encoding, Collections.EMPTY_LIST, Collections.EMPTY_LIST, session ); mavenResourcesExecution.setEscapeWindowsPaths( true ); mavenResourcesFiltering.filterResources( mavenResourcesExecution ); } catch ( MavenFilteringException ex ) { throw new MojoExecutionException( ex.getMessage(), ex ); } }
/** {@inheritDoc} */ public void copyFile( File from, File to, boolean filtering, List<FileUtils.FilterWrapper> filterWrappers, String encoding, boolean overwrite ) throws MavenFilteringException { try { if ( filtering ) { if ( getLogger().isDebugEnabled() ) { getLogger().debug( "filtering " + from.getPath() + " to " + to.getPath() ); } filterFile( from, to, encoding, filterWrappers ); } else { if ( getLogger().isDebugEnabled() ) { getLogger().debug( "copy " + from.getPath() + " to " + to.getPath() ); } FileUtils.copyFile( from, to, encoding, new FileUtils.FilterWrapper[0], overwrite ); } buildContext.refresh( to ); } catch ( IOException e ) { throw new MavenFilteringException( e.getMessage(), e ); } }
private void copyNbmResources() throws MojoExecutionException { try { if ( StringUtils.isEmpty( encoding ) && isFilteringEnabled( nbmResources ) ) { getLog().warn( "File encoding has not been set, using platform encoding " + ReaderFactory.FILE_ENCODING + ", i.e. build is platform dependent!" ); } MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution( Arrays.asList( nbmResources ), clusterDir, project, encoding, Collections.EMPTY_LIST, Collections.EMPTY_LIST, session ); mavenResourcesExecution.setEscapeWindowsPaths( true ); mavenResourcesFiltering.filterResources( mavenResourcesExecution ); } catch ( MavenFilteringException ex ) { throw new MojoExecutionException( ex.getMessage(), ex ); } }
throw new MavenFilteringException( "mavenResourcesExecution cannot be null" ); throw new MavenFilteringException( "outputDirectory cannot be null" ); if ( !outputExists && !outputDirectory.mkdirs() ) throw new MavenFilteringException( "Cannot create resource output directory: " + outputDirectory ); throw new MavenFilteringException( "Cannot copy directory structure from " + resourceDirectory.getPath() + " to " + outputDirectory.getPath() );
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); } }
getLog().error( "error filtering context.xml : " + e.getMessage(), e ); throw new MojoExecutionException( "error filtering context.xml : " + e.getMessage(), e );
getLog().error( "error filtering context.xml : " + e.getMessage(), e ); throw new MojoExecutionException( "error filtering context.xml : " + e.getMessage(), e );
throw new MojoExecutionException( "filtering issue: " + e.getMessage(), e );
throw new MojoExecutionException( "filtering issue: " + e.getMessage(), e );
throw new MojoExecutionException( "filtering issue: " + e.getMessage(), e );
IOException ioe = new IOException( "Error filtering file '" + source + "': " + e.getMessage(), e ); throw ioe;
throw new MojoExecutionException( e.getMessage(), e );
throw new MojoExecutionException("Failure while processing/filtering markdown sources: " + e.getMessage(), e);
throw new MojoExecutionException( e.getMessage(), e );