1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.common.maven.spring;
17
18 import java.util.Properties;
19
20 import org.apache.maven.project.MavenProject;
21 import org.apache.maven.settings.Settings;
22 import org.kuali.common.util.Assert;
23 import org.kuali.common.util.FormatUtils;
24 import org.kuali.common.util.execute.Executable;
25 import org.kuali.common.util.maven.MavenUtils;
26 import org.slf4j.Logger;
27 import org.slf4j.LoggerFactory;
28
29 public class AugmentMavenPropertiesExecutable implements Executable {
30
31 public AugmentMavenPropertiesExecutable(MavenProject mavenProject, Settings settings, boolean skip) {
32 Assert.noNulls(mavenProject);
33 this.mavenProject = mavenProject;
34 this.settings = settings;
35 this.skip = skip;
36 }
37
38 private static final Logger logger = LoggerFactory.getLogger(AugmentMavenPropertiesExecutable.class);
39
40 private final MavenProject mavenProject;
41 private final Settings settings;
42 private final boolean skip;
43
44 @Override
45 public void execute() {
46
47 if (skip) {
48 return;
49 }
50
51
52 Properties mavenProperties = mavenProject.getProperties();
53
54
55 int originalSize = mavenProperties.size();
56
57
58
59 Properties internal = MavenAwareUtils.getInternalProperties(mavenProject, settings);
60
61
62 mavenProperties.putAll(internal);
63
64
65
66 MavenUtils.augmentProjectProperties(mavenProperties);
67
68
69 logger.debug("Added {} properties", FormatUtils.getCount(mavenProperties.size() - originalSize));
70
71 }
72
73 public MavenProject getMavenProject() {
74 return mavenProject;
75 }
76
77 public Settings getSettings() {
78 return settings;
79 }
80
81 public boolean isSkip() {
82 return skip;
83 }
84
85 }