| package org.apache.maven.plugin.coreit; |
| |
| import org.apache.maven.plugin.AbstractMojo; |
| import org.apache.maven.plugin.MojoExecutionException; |
| |
| import java.util.Properties; |
| import java.io.FileOutputStream; |
| import java.io.File; |
| |
| /** |
| * @goal generate-properties |
| * @phase validate |
| */ |
| public class UsesPropertiesMojo |
| extends AbstractMojo |
| { |
| /** |
| * @parameter expression=${basedir}" |
| */ |
| private File basedir; |
| |
| /** |
| * @parameter expression="${project.properties}" |
| */ |
| private Properties properties; |
| |
| public void execute() |
| throws MojoExecutionException |
| { |
| try |
| { |
| FileOutputStream fos = new FileOutputStream( new File( basedir, "target/project.properties" ) ); |
| |
| properties.store( fos, "# Properties generated by the execution of a mojo that uses interpolated POM values for configuration." ); |
| } |
| catch( Exception e ) |
| { |
| getLog().error( "Error creating mojo generated properties.", e ); |
| } |
| } |
| } |