private File[] mavenFilterFiles(File[] resourceFiles, File outDir) throws MojoExecutionException { if (!outDir.exists()) { if (!outDir.mkdirs()) { throw new MojoExecutionException("Cannot create working dir " + outDir); } } File[] ret = new File[resourceFiles.length]; int i = 0; for (File resource : resourceFiles) { File targetFile = new File(outDir, resource.getName()); try { mavenFileFilter.copyFile(resource, targetFile, true, project, null, false, "utf8", session); ret[i++] = targetFile; } catch (MavenFilteringException exp) { throw new MojoExecutionException( String.format("Cannot filter %s to %s", resource, targetFile), exp); } } return ret; }
private void writeSourceFile(GitRepository repository, File sourceFile) throws GitRepositoryException, IOException, MavanagaiataMojoException, MavenFilteringException { File packageDirectory = new File(outputDirectory, packageName.replace('.', '/')); File outputFile = new File(packageDirectory, sourceFile.getName()); boolean fileOk; if (outputFile.exists()) { fileOk = outputFile.delete(); } else { fileOk = (packageDirectory.exists() || packageDirectory.mkdirs()) && outputFile.createNewFile(); } if (!fileOk) { throw MavanagaiataMojoException.create("Could not create class source: %s", null, outputFile.getAbsolutePath()); } List<FileUtils.FilterWrapper> filterWrappers = singletonList(new ValueSourceFilter(repository)); fileFilter.copyFile(sourceFile, outputFile, true, filterWrappers, encoding, true); }
try { tmp = File.createTempFile("sling", "bootstrap"); mavenFileFilter.copyFile(bootstrapFile, tmp, true, project, Collections.EMPTY_LIST, true, System.getProperty("file.encoding"), mavenSession); reader = new FileReader(tmp);
/** * Load the config, do filtering as needed. * * @param config The config to load into. * @param configFile The config file. */ protected void loadConfig(EnunciateConfiguration config, File configFile) throws IOException, SAXException, MavenFilteringException { if (this.configFilter == null) { getLog().debug("No maven file filter was provided, so no filtering of the config file will be done."); config.load(configFile); } else { this.scratchDir.mkdirs(); File filteredConfig = File.createTempFile("enunciateConfig", ".xml", this.scratchDir); getLog().debug("Filtering " + configFile + " to " + filteredConfig + "..."); this.configFilter.copyFile(configFile, filteredConfig, true, this.project, new ArrayList(), true, "utf-8", this.session); config.load(filteredConfig); } }
/** * Load the config, do filtering as needed. * * @param config The config to load into. * @param configFile The config file. */ protected void loadConfig(Enunciate config, File configFile) throws IOException, SAXException, MavenFilteringException { if (this.configFilter == null) { getLog().debug("[ENUNCIATE] No maven file filter was provided, so no filtering of the config file will be done."); config.loadConfiguration(configFile); } else { this.buildDir.mkdirs(); File filteredConfig = File.createTempFile("enunciateConfig", ".xml", this.buildDir); getLog().debug("[ENUNCIATE] Filtering " + configFile + " to " + filteredConfig + "..."); this.configFilter.copyFile(configFile, filteredConfig, true, this.project, new ArrayList(), true, "utf-8", this.session); config.loadConfiguration(filteredConfig); //load the filtered configuration... config.getConfiguration().setConfigFile(configFile); //but make sure the original is still the config file location. } }
/** * Load the config, do filtering as needed. * * @param config The config to load into. * @param configFile The config file. */ protected void loadConfig(Enunciate config, File configFile) throws IOException, SAXException, MavenFilteringException { if (this.configFilter == null) { getLog().debug("[ENUNCIATE] No maven file filter was provided, so no filtering of the config file will be done."); config.loadConfiguration(configFile); } else { this.buildDir.mkdirs(); File filteredConfig = File.createTempFile("enunciateConfig", ".xml", this.buildDir); getLog().debug("[ENUNCIATE] Filtering " + configFile + " to " + filteredConfig + "..."); this.configFilter.copyFile(configFile, filteredConfig, true, this.project, new ArrayList(), true, "utf-8", this.session); config.loadConfiguration(filteredConfig); //load the filtered configuration... config.getConfiguration().setConfigFile(configFile); //but make sure the original is still the config file location. } }
try { tmp = File.createTempFile("sling", "props"); mavenFileFilter.copyFile(propertiesFile, tmp, true, project, Collections.EMPTY_LIST, true, System.getProperty("file.encoding"), mavenSession); Properties loadedProps = PropertyUtils.loadPropertyFile(tmp, null);
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); } }
try { tmp = File.createTempFile("sling", "props"); mavenFileFilter.copyFile(propsFile, tmp, true, project, Collections.EMPTY_LIST, true, System.getProperty("file.encoding"), mavenSession); final Properties loadedProps = PropertyUtils.loadPropertyFile(tmp, null);
mavenFileFilterRequest.setFiltering( true ); mavenFileFilter.copyFile( mavenFileFilterRequest );
mavenFileFilterRequest.setFiltering( true ); mavenFileFilter.copyFile( mavenFileFilterRequest );
mavenFileFilterRequest.setFiltering( true ); mavenFileFilter.copyFile( mavenFileFilterRequest );
context.getMavenFileFilter().copyFile( webXml, new File( webinfDir, "web.xml" ), true, context.getFilterWrappers(), getEncoding( webXml ) ); context.getMavenFileFilter().copyFile( defaultWebXml, new File( webinfDir, "web.xml" ), true, context.getFilterWrappers(), getEncoding( defaultWebXml ) ); context.getMavenFileFilter().copyFile( containerConfigXML, new File( metainfDir, xmlFileName ), true, context.getFilterWrappers(), getEncoding( containerConfigXML ) );
mavenFileFilterRequest.setFiltering( true ); mavenFileFilter.copyFile( mavenFileFilterRequest );
mavenFileFilterRequest.setFiltering( true ); mavenFileFilter.copyFile( mavenFileFilterRequest );
mavenFileFilter.copyFile( inFile, outFile, true, filterWrappers, null ); if ( !isIgnorePermissions() )
mavenFileFilter.copyFile( inFile, outFile, true, filterWrappers, null ); if ( !isIgnorePermissions() )
context.getMavenFileFilter().copyFile( file, targetFile, true, context.getFilterWrappers(), encoding );
filteredFileExtension( source.getName(), mavenResourcesExecution.getNonFilteredFileExtensions() ); mavenFileFilter.copyFile( source, destinationFile, resource.isFiltering() && filteredExt, mavenResourcesExecution.getFilterWrappers(), mavenResourcesExecution.getEncoding(),