bw-maven-plugin/src/main/java/fr/fastconnect/factory/tibco/bw/maven/packaging/AbstractPackagingMojo.java
protected void savePropertiesToFile(File outputFile, Properties properties, String propertiesComment, String success, String failure) throws MojoExecutionException {
		OutputStream outputStream = null;
		
		try {
			outputFile.getParentFile().mkdirs();
			outputStream = new FileOutputStream(outputFile);
			properties.store(outputStream, propertiesComment);
			
			if (filterProperties) {
				getLog().debug("Filtering properties files");

				File tmpDir = new File(outputFile.getParentFile(), "tmp");
				tmpDir.mkdir();
				List<Resource> resources = new ArrayList<Resource>();
				Resource r = new Resource();
				r.setDirectory(outputFile.getParentFile().getAbsolutePath());
				r.addInclude("*.properties");
				r.setFiltering(true);
				resources.add(r);
				
				ArrayList<Object> filters = new ArrayList<Object>();
				List<String> nonFilteredFileExtensions = new ArrayList<String>();
				
				MavenResourcesExecution mre = new MavenResourcesExecution(resources, tmpDir, this.getProject(), this.sourceEncoding, filters, nonFilteredFileExtensions, session);
				mavenResourcesFiltering.filterResources(mre);
				
				FileUtils.copyDirectory(tmpDir, outputFile.getParentFile());
				FileUtils.deleteDirectory(tmpDir);
			}

			getLog().info(success + " '" + outputFile + "'");
		} catch (Exception e) {
			throw new MojoExecutionException(failure + " '" + outputFile + "'", e);
		} finally {
			try {
				outputStream.close();
			} catch (Exception e) {
			}
		}
	}
protected void savePropertiesToFile(File outputFile, Properties properties, String propertiesComment, String success, String failure) throws MojoExecutionException {
		OutputStream outputStream = null;
		
		try {
			outputFile.getParentFile().mkdirs();
			outputStream = new FileOutputStream(outputFile);
			properties.store(outputStream, propertiesComment);
			
			if (filterProperties) {
				getLog().debug("Filtering properties files");

				File tmpDir = new File(outputFile.getParentFile(), "tmp");
				tmpDir.mkdir();
				List<Resource> resources = new ArrayList<Resource>();
				Resource r = new Resource();
				r.setDirectory(outputFile.getParentFile().getAbsolutePath());
				r.addInclude("*.properties");
				r.setFiltering(true);
				resources.add(r);
				
				ArrayList<Object> filters = new ArrayList<Object>();
				List<String> nonFilteredFileExtensions = new ArrayList<String>();
				
				MavenResourcesExecution mre = new MavenResourcesExecution(resources, tmpDir, this.getProject(), this.sourceEncoding, filters, nonFilteredFileExtensions, session);
				mavenResourcesFiltering.filterResources(mre);
				
				FileUtils.copyDirectory(tmpDir, outputFile.getParentFile());
				FileUtils.deleteDirectory(tmpDir);
			}

			getLog().info(success + " '" + outputFile + "'");
		} catch (Exception e) {
			throw new MojoExecutionException(failure + " '" + outputFile + "'", e);
		} finally {
			try {
				outputStream.close();
			} catch (Exception e) {
			}
		}
	}
<p>
This saves a java.util.Properties to a file.<br />

It is possible to add a comment at the beginning of the file.
</p>

@param outputFile, the File where to output the Properties
@param properties, the Properties to save
@param propertiesComment, the comment to add at the beginning of the file
@param success, the success message
@param failure, the failure message
@throws MojoExecutionException