1 package org.apache.maven.plugin.coreit;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.maven.plugin.AbstractMojo;
23 import org.apache.maven.plugin.MojoExecutionException;
24
25 import java.util.Properties;
26 import java.io.FileOutputStream;
27 import java.io.File;
28
29
30
31
32
33 public class UsesPropertiesMojo
34 extends AbstractMojo
35 {
36
37
38
39 private File basedir;
40
41
42
43
44 private Properties properties;
45
46 public void execute()
47 throws MojoExecutionException
48 {
49 try
50 {
51 File file = new File( basedir, "target/project.properties" );
52 file.getParentFile().mkdirs();
53 FileOutputStream fos = new FileOutputStream( file );
54
55 properties.store( fos, "# Properties generated by the execution of a mojo that uses"
56 + " interpolated POM values for configuration." );
57 }
58 catch ( Exception e )
59 {
60 getLog().error( "Error creating mojo generated properties.", e );
61 }
62 }
63 }