This is an automated email from the ASF dual-hosted git repository.
cziegeler pushed a commit to branch master
in repository
https://gitbox.apache.org/repos/asf/sling-slingfeature-maven-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new bea7191 SLING-8689 : Improve version handling
bea7191 is described below
commit bea7191bb2f402d599da7786bed28d2c46b953b8
Author: Carsten Ziegeler <[email protected]>
AuthorDate: Tue Sep 10 07:37:36 2019 +0200
SLING-8689 : Improve version handling
---
.../feature/maven/mojos/UpdateVersionsMojo.java | 23 ++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git
a/src/main/java/org/apache/sling/feature/maven/mojos/UpdateVersionsMojo.java
b/src/main/java/org/apache/sling/feature/maven/mojos/UpdateVersionsMojo.java
index f2d940b..d5635e7 100644
--- a/src/main/java/org/apache/sling/feature/maven/mojos/UpdateVersionsMojo.java
+++ b/src/main/java/org/apache/sling/feature/maven/mojos/UpdateVersionsMojo.java
@@ -344,28 +344,35 @@ public class UpdateVersionsMojo extends
AbstractIncludingFeatureMojo {
return include;
}
+ private boolean match(final String value, final String matcher) {
+ if (matcher.endsWith("*")) {
+ return value.startsWith(matcher.substring(0, matcher.length() -
1));
+ }
+ return matcher.equals(value);
+ }
+
private String match(final ArtifactId id, final List<String[]> matches,
final List<String> versionInfo) {
boolean match = false;
int index = 0;
for(final String[] m : matches) {
- match = id.getGroupId().equals(m[0]);
+ match = match(id.getGroupId(), m[0]);
if (match && m.length > 1) {
- match = id.getArtifactId().equals(m[1]);
+ match = match(id.getArtifactId(), m[1]);
}
if (match && m.length == 3) {
- match = id.getVersion().equals(m[2]);
+ match = match(id.getVersion(), m[2]);
} else if (match && m.length == 4) {
- match = id.getVersion().equals(m[3]);
+ match = match(id.getVersion(), m[3]);
if (match) {
- match = id.getType().equals(m[2]);
+ match = match(id.getType(), m[2]);
}
} else if (match && m.length == 5) {
- match = id.getVersion().equals(m[4]);
+ match = match(id.getVersion(), m[4]);
if (match) {
- match = id.getType().equals(m[2]);
+ match = match(id.getType(), m[2]);
if (match) {
- match = m[3].equals(id.getClassifier());
+ match = match(id.getClassifier(), m[3]);
}
}
}