1 |
|
package org.codehaus.mojo.properties; |
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
import org.apache.maven.model.Profile; |
7 |
|
import org.apache.maven.plugin.MojoExecutionException; |
8 |
|
|
9 |
|
import java.util.Iterator; |
10 |
|
import java.util.List; |
11 |
|
import java.util.Properties; |
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
0 |
public class WriteActiveProfileProperties |
21 |
0 |
extends AbstractWritePropertiesMojo |
22 |
|
{ |
23 |
|
|
24 |
|
public void execute() |
25 |
|
throws MojoExecutionException { |
26 |
0 |
validateOutputFile(); |
27 |
0 |
List list = project.getActiveProfiles(); |
28 |
0 |
if (getLog().isInfoEnabled()) { |
29 |
0 |
getLog().info(list.size() + " profile(s) active"); |
30 |
0 |
} |
31 |
0 |
Properties properties = new Properties(); |
32 |
0 |
for (Iterator iter = list.iterator(); iter.hasNext();) { |
33 |
0 |
Profile profile = (Profile) iter.next(); |
34 |
0 |
if (profile.getProperties() != null) { |
35 |
0 |
properties.putAll(profile.getProperties()); |
36 |
0 |
} |
37 |
0 |
} |
38 |
0 |
|
39 |
0 |
writeProperties(properties, outputFile); |
40 |
0 |
} |
41 |
0 |
} |
42 |
|
|