1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.plugin.internal;
20
21 import java.util.Arrays;
22 import java.util.List;
23
24 import org.apache.maven.plugin.PluginValidationManager;
25
26
27
28
29
30
31 abstract class AbstractMavenPluginDescriptorSourcedParametersValidator extends AbstractMavenPluginParametersValidator {
32
33
34
35
36
37 private static final List<String> IGNORED_PROPERTY_VALUES = Arrays.asList(
38 "basedir",
39 "executedProject",
40 "localRepository",
41 "mojo",
42 "mojoExecution",
43 "plugin",
44 "project",
45 "reactorProjects",
46 "session",
47 "settings");
48
49 private static final List<String> IGNORED_PROPERTY_PREFIX =
50 Arrays.asList("mojo.", "pom.", "plugin.", "project.", "session.", "settings.");
51
52 protected AbstractMavenPluginDescriptorSourcedParametersValidator(PluginValidationManager pluginValidationManager) {
53 super(pluginValidationManager);
54 }
55
56 @Override
57 protected boolean isIgnoredProperty(String strValue) {
58 if (!strValue.startsWith("${")) {
59 return false;
60 }
61
62 String propertyName = strValue.replace("${", "").replace("}", "");
63
64 if (IGNORED_PROPERTY_VALUES.contains(propertyName)) {
65 return true;
66 }
67
68 return IGNORED_PROPERTY_PREFIX.stream().anyMatch(propertyName::startsWith);
69 }
70 }