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 static org.kuali.common.maven.spring.MavenAwareUtils.getInternalProperties;
19 import static org.kuali.common.util.FormatUtils.getCount;
20 import static org.kuali.common.util.base.Precondition.checkNotNull;
21 import static org.kuali.common.util.log.Loggers.newLogger;
22 import static org.kuali.common.util.maven.MavenUtils.augmentProjectProperties;
23
24 import java.util.Properties;
25
26 import org.apache.maven.project.MavenProject;
27 import org.apache.maven.settings.Settings;
28 import org.kuali.common.util.execute.Executable;
29 import org.slf4j.Logger;
30
31 public class AugmentMavenPropertiesExecutable implements Executable {
32
33 private static final Logger logger = newLogger();
34
35 public AugmentMavenPropertiesExecutable(MavenProject mavenProject, Settings settings, boolean skip) {
36 this.mavenProject = checkNotNull(mavenProject, "mavenProject");
37 this.settings = settings;
38 this.skip = skip;
39 }
40
41 private final MavenProject mavenProject;
42 private final Settings settings;
43 private final boolean skip;
44
45 @Override
46 public void execute() {
47
48 if (skip) {
49 return;
50 }
51
52
53 Properties mavenProperties = mavenProject.getProperties();
54
55
56 int originalSize = mavenProperties.size();
57
58
59
60 Properties internal = getInternalProperties(mavenProject, settings);
61
62
63 mavenProperties.putAll(internal);
64
65
66
67 augmentProjectProperties(mavenProperties);
68
69
70 logger.debug("Added {} properties", getCount(mavenProperties.size() - originalSize));
71
72 }
73
74 public MavenProject getMavenProject() {
75 return mavenProject;
76 }
77
78 public Settings getSettings() {
79 return settings;
80 }
81
82 public boolean isSkip() {
83 return skip;
84 }
85
86 }