Skip to content

Commit

Permalink
Added timestamped snapshot version to example regular expressions
Browse files Browse the repository at this point in the history
`*-SNAPSHOT` versions can also be matched against their timestamped representation,
such as `*-20211206.032231-24`  We have modified the example snapshot regular
expression to match either form of snapshot version.
  • Loading branch information
ao-apps committed Dec 6, 2021
1 parent 3e9a72a commit 301e3c7
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 36 deletions.
16 changes: 8 additions & 8 deletions src/site/markdown/keysmap-format.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,24 +97,24 @@ match a specific artifact with the version and any packaging
test.groupId:artifactId:1.0.0 = 0x1234567890123456789012345678901234567890
---

match any artifact from group with any packaging and a SNAPSHOT version by regular expression
match any artifact from group with any packaging and a SNAPSHOT/timestamped version by regular expression

test.groupId:*:~.*-SNAPSHOT$ = 0x1234567890123456789012345678901234567890
test.groupId:*:~.*-(SNAPSHOT|\d{8,}\.\d{6}-\d+) = 0x1234567890123456789012345678901234567890
---

match any artifact from group with any packaging and a non-SNAPSHOT version by negated regular expression
match any artifact from group with any packaging and a non-SNAPSHOT/timestamped version by negated regular expression

test.groupId:*:!~.*-SNAPSHOT$ = 0x1234567890123456789012345678901234567890
test.groupId:*:!~.*-(SNAPSHOT|\d{8,}\.\d{6}-\d+) = 0x1234567890123456789012345678901234567890
---

match a specific artifact with any packaging and a SNAPSHOT version by regular expression
match a specific artifact with any packaging and a SNAPSHOT/timestamped version by regular expression

test.groupId:artifactId:~.*-SNAPSHOT$ = 0x1234567890123456789012345678901234567890
test.groupId:artifactId:~.*-(SNAPSHOT|\d{8,}\.\d{6}-\d+) = 0x1234567890123456789012345678901234567890
---

match a specific artifact with specific packaging and a SNAPSHOT version by regular expression
match a specific artifact with specific packaging and a SNAPSHOT/timestamped version by regular expression

test.groupId:artifactId:jar:~.*-SNAPSHOT$ = 0x1234567890123456789012345678901234567890
test.groupId:artifactId:jar:~.*-(SNAPSHOT|\d{8,}\.\d{6}-\d+) = 0x1234567890123456789012345678901234567890
---

match a specific artifact with any version and packaging and many keys
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,34 +75,36 @@ public Object[][] artifactsList() {
{"test.*", testArtifact().build(), true},
{"*", testArtifact().build(), true},
// Regular expression in version
{"test.group:test:~.*-SNAPSHOT$", testArtifact().build(), false},
{"test.group:test:!~.*-SNAPSHOT$", testArtifact().build(), true},
{"test.group:test:~.*-SNAPSHOT$", testArtifact().version("1.1.1-SNAPSHOT").build(), true},
{"test.group:test:!~.*-SNAPSHOT$", testArtifact().version("1.1.1-SNAPSHOT").build(), false},
{"test.group:*:~.*-SNAPSHOT$", testArtifact().build(), false},
{"test.group:*:!~.*-SNAPSHOT$", testArtifact().build(), true},
{"test.group:*:~.*-SNAPSHOT$", testArtifact().version("1.1.1-SNAPSHOT").build(), true},
{"test.group:*:!~.*-SNAPSHOT$", testArtifact().version("1.1.1-SNAPSHOT").build(), false},
{"test.group:*:jar:~.*-SNAPSHOT$", testArtifact().build(), false},
{"test.group:*:jar:!~.*-SNAPSHOT$", testArtifact().build(), true},
{"test.group:*:jar:~.*-SNAPSHOT$", testArtifact().version("1.1.1-SNAPSHOT").build(), true},
{"test.group:*:jar:!~.*-SNAPSHOT$", testArtifact().version("1.1.1-SNAPSHOT").build(), false},
{"test.group:*:pom:~.*-SNAPSHOT$", testArtifact().version("1.1.1-SNAPSHOT").build(), false},
{"test.group:*:pom:!~.*-SNAPSHOT$", testArtifact().version("1.1.1-SNAPSHOT").build(), false},
{"test.group:test:jar:~.*-SNAPSHOT$", testArtifact().build(), false},
{"test.group:test:jar:!~.*-SNAPSHOT$", testArtifact().build(), true},
{"test.group:test:jar:~.*-SNAPSHOT$", testArtifact().version("1.1.1-SNAPSHOT").build(), true},
{"test.group:test:jar:!~.*-SNAPSHOT$", testArtifact().version("1.1.1-SNAPSHOT").build(), false},
{"test.group:test:pom:~.*-SNAPSHOT$", testArtifact().version("1.1.1-SNAPSHOT").build(), false},
{"test.group:test:pom:!~.*-SNAPSHOT$", testArtifact().version("1.1.1-SNAPSHOT").build(), false},
{"test.group:other:jar:~.*-SNAPSHOT$", testArtifact().version("1.1.1-SNAPSHOT").build(), false},
{"test.group:other:jar:!~.*-SNAPSHOT$", testArtifact().version("1.1.1-SNAPSHOT").build(), false},
{"other.group:test:jar:~.*-SNAPSHOT$", testArtifact().version("1.1.1-SNAPSHOT").build(), false},
{"other.group:test:jar:!~.*-SNAPSHOT$", testArtifact().version("1.1.1-SNAPSHOT").build(), false},
{"test.group:test:jar:~.*-SNAPshot$", testArtifact().version("1.1.1-snapSHOT").build(), true},
{"test.group:test:jar:!~.*-SNAPshot$", testArtifact().version("1.1.1-snapSHOT").build(), false},
{"test.group:test:jar:~.*-snapSHOT$", testArtifact().version("1.1.1-SNAPshot").build(), true},
{"test.group:test:jar:!~.*-snapSHOT$", testArtifact().version("1.1.1-SNAPshot").build(), false},
{"test.group:test:~.*-SNAPSHOT", testArtifact().build(), false},
{"test.group:test:!~.*-SNAPSHOT", testArtifact().build(), true},
{"test.group:test:~.*-SNAPSHOT", testArtifact().version("1.1.1-SNAPSHOT").build(), true},
{"test.group:test:!~.*-SNAPSHOT", testArtifact().version("1.1.1-SNAPSHOT").build(), false},
{"test.group:test:~.*-SNAPSHOT", testArtifact().version("1.1.1-SNAPSHOT-malicious").build(), false},
{"test.group:test:!~.*-SNAPSHOT", testArtifact().version("1.1.1-SNAPSHOT-malicious").build(), true},
{"test.group:*:~.*-SNAPSHOT", testArtifact().build(), false},
{"test.group:*:!~.*-SNAPSHOT", testArtifact().build(), true},
{"test.group:*:~.*-SNAPSHOT", testArtifact().version("1.1.1-SNAPSHOT").build(), true},
{"test.group:*:!~.*-SNAPSHOT", testArtifact().version("1.1.1-SNAPSHOT").build(), false},
{"test.group:*:jar:~.*-SNAPSHOT", testArtifact().build(), false},
{"test.group:*:jar:!~.*-SNAPSHOT", testArtifact().build(), true},
{"test.group:*:jar:~.*-SNAPSHOT", testArtifact().version("1.1.1-SNAPSHOT").build(), true},
{"test.group:*:jar:!~.*-SNAPSHOT", testArtifact().version("1.1.1-SNAPSHOT").build(), false},
{"test.group:*:pom:~.*-SNAPSHOT", testArtifact().version("1.1.1-SNAPSHOT").build(), false},
{"test.group:*:pom:!~.*-SNAPSHOT", testArtifact().version("1.1.1-SNAPSHOT").build(), false},
{"test.group:test:jar:~.*-SNAPSHOT", testArtifact().build(), false},
{"test.group:test:jar:!~.*-SNAPSHOT", testArtifact().build(), true},
{"test.group:test:jar:~.*-SNAPSHOT", testArtifact().version("1.1.1-SNAPSHOT").build(), true},
{"test.group:test:jar:!~.*-SNAPSHOT", testArtifact().version("1.1.1-SNAPSHOT").build(), false},
{"test.group:test:pom:~.*-SNAPSHOT", testArtifact().version("1.1.1-SNAPSHOT").build(), false},
{"test.group:test:pom:!~.*-SNAPSHOT", testArtifact().version("1.1.1-SNAPSHOT").build(), false},
{"test.group:other:jar:~.*-SNAPSHOT", testArtifact().version("1.1.1-SNAPSHOT").build(), false},
{"test.group:other:jar:!~.*-SNAPSHOT", testArtifact().version("1.1.1-SNAPSHOT").build(), false},
{"other.group:test:jar:~.*-SNAPSHOT", testArtifact().version("1.1.1-SNAPSHOT").build(), false},
{"other.group:test:jar:!~.*-SNAPSHOT", testArtifact().version("1.1.1-SNAPSHOT").build(), false},
{"test.group:test:jar:~.*-SNAPshot", testArtifact().version("1.1.1-snapSHOT").build(), true},
{"test.group:test:jar:!~.*-SNAPshot", testArtifact().version("1.1.1-snapSHOT").build(), false},
{"test.group:test:jar:~.*-snapSHOT", testArtifact().version("1.1.1-SNAPshot").build(), true},
{"test.group:test:jar:!~.*-snapSHOT", testArtifact().version("1.1.1-SNAPshot").build(), false},
};
}

Expand Down

0 comments on commit 301e3c7

Please sign in to comment.