You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "cstamas (via GitHub)" <gi...@apache.org> on 2025/11/27 18:00:08 UTC
[PR] GH-1668: Add catch-all for group filter [maven-resolver]
cstamas opened a new pull request, #1694:
URL: https://github.com/apache/maven-resolver/pull/1694
Introduced `*` "root" entry, that may define the "default acceptance".
Fixes #1668
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-1668: Add catch-all for group filter [maven-resolver]
Posted by "cstamas (via GitHub)" <gi...@apache.org>.
cstamas commented on code in PR #1694:
URL: https://github.com/apache/maven-resolver/pull/1694#discussion_r2569948672
##########
src/site/markdown/remote-repository-filtering.md:
##########
@@ -181,6 +181,16 @@ Lines 1 and 2 are ignored. Line 3 means "allow `org.apache.maven` G and below".
only" (so `org.apache.maven.foo.bar` is allowed due first line). Line 5 means "disallow `org.apache.maven.indexer` and below"
and finally line 6 means "allow `org.apache.bar` ONLY" (so `org.apache.bar.foo` is NOT enabled).
+One can use one special entry "root" `*` (asterisk) to define the "default acceptance" (that without it
+defaults to REJECTED). Similarly, adding `!*` to file defines "default acceptance" of FALSE/REJECTED as well,
+and adding it to file changes nothing, as this is the default acceptance (but may serve some documentation purposes).
+Be aware: In case a line with single asterisk `*` is present, the whole logic of Group filter is getting inverted,
+hence there is no need to add "allowed entries" (they are allowed by default), but one can add "disallowed entries" by
+adding `!com.foo` and alike.
+
+Conflicting rules: rule parser is intentionally trivial, so in case of conflicting rules the "first wins" strategy is
+applied. Ideally, user should keep files sorted or handle them in a way one can detect conflicts in it.
+
Review Comment:
So, due this, any ordering/permution of following lines:
```
org.apache
org.eclipse
org.codehaus
```
will allways result in same tree:
```
org
/ | \
apache eclipse codehaus
```
##########
src/site/markdown/remote-repository-filtering.md:
##########
@@ -181,6 +181,16 @@ Lines 1 and 2 are ignored. Line 3 means "allow `org.apache.maven` G and below".
only" (so `org.apache.maven.foo.bar` is allowed due first line). Line 5 means "disallow `org.apache.maven.indexer` and below"
and finally line 6 means "allow `org.apache.bar` ONLY" (so `org.apache.bar.foo` is NOT enabled).
+One can use one special entry "root" `*` (asterisk) to define the "default acceptance" (that without it
+defaults to REJECTED). Similarly, adding `!*` to file defines "default acceptance" of FALSE/REJECTED as well,
+and adding it to file changes nothing, as this is the default acceptance (but may serve some documentation purposes).
+Be aware: In case a line with single asterisk `*` is present, the whole logic of Group filter is getting inverted,
+hence there is no need to add "allowed entries" (they are allowed by default), but one can add "disallowed entries" by
+adding `!com.foo` and alike.
+
+Conflicting rules: rule parser is intentionally trivial, so in case of conflicting rules the "first wins" strategy is
+applied. Ideally, user should keep files sorted or handle them in a way one can detect conflicts in it.
+
Review Comment:
So, due this, any ordering/permutation of following lines:
```
org.apache
org.eclipse
org.codehaus
```
will allways result in same tree:
```
org
/ | \
apache eclipse codehaus
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-1668: Add catch-all for group filter [maven-resolver]
Posted by "cstamas (via GitHub)" <gi...@apache.org>.
cstamas commented on code in PR #1694:
URL: https://github.com/apache/maven-resolver/pull/1694#discussion_r2571541543
##########
maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/filter/ruletree/GroupTreeTest.java:
##########
@@ -50,5 +50,59 @@ void smoke() {
assertTrue(groupTree.acceptedGroupId("org.apache.baz"));
assertFalse(groupTree.acceptedGroupId("org.apache.baz.aaa"));
+
+ assertFalse(groupTree.acceptedGroupId("not.in.list.but.uses.default"));
+ }
+
+ @Test
+ void smokeWithPositiveDefault() {
+ GroupTree groupTree = new GroupTree("root");
+ groupTree.loadNodes(Stream.of(
+ "# comment",
+ "",
+ "org.apache.maven",
+ "!=org.apache.maven.foo",
+ "!org.apache.maven.bar",
+ "=org.apache.baz",
+ "*"));
+ assertTrue(groupTree.acceptedGroupId("org.apache.maven"));
+ assertTrue(groupTree.acceptedGroupId("org.apache.maven.aaa"));
+
+ assertFalse(groupTree.acceptedGroupId("org.apache.maven.foo"));
+ assertTrue(groupTree.acceptedGroupId("org.apache.maven.foo.aaa"));
+
+ assertFalse(groupTree.acceptedGroupId("org.apache.maven.bar"));
+ assertFalse(groupTree.acceptedGroupId("org.apache.maven.bar.aaa"));
+
+ assertTrue(groupTree.acceptedGroupId("org.apache.baz"));
+ assertFalse(groupTree.acceptedGroupId("org.apache.baz.aaa"));
Review Comment:
We have a problem here.
Applicable rules:
```
=org.apache.baz
*
```
1st: "allow `org.apache.baz` ONLY"
2nd: default to ALLOW
So why is then `org.apache.baz.aaa` rejected?
Seems the mod `=` causes some issues....
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-1668: Add catch-all for group filter [maven-resolver]
Posted by "cstamas (via GitHub)" <gi...@apache.org>.
cstamas commented on code in PR #1694:
URL: https://github.com/apache/maven-resolver/pull/1694#discussion_r2571586014
##########
maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/filter/ruletree/GroupTreeTest.java:
##########
@@ -50,5 +50,59 @@ void smoke() {
assertTrue(groupTree.acceptedGroupId("org.apache.baz"));
assertFalse(groupTree.acceptedGroupId("org.apache.baz.aaa"));
+
+ assertFalse(groupTree.acceptedGroupId("not.in.list.but.uses.default"));
+ }
+
+ @Test
+ void smokeWithPositiveDefault() {
+ GroupTree groupTree = new GroupTree("root");
+ groupTree.loadNodes(Stream.of(
+ "# comment",
+ "",
+ "org.apache.maven",
+ "!=org.apache.maven.foo",
+ "!org.apache.maven.bar",
+ "=org.apache.baz",
+ "*"));
+ assertTrue(groupTree.acceptedGroupId("org.apache.maven"));
+ assertTrue(groupTree.acceptedGroupId("org.apache.maven.aaa"));
+
+ assertFalse(groupTree.acceptedGroupId("org.apache.maven.foo"));
+ assertTrue(groupTree.acceptedGroupId("org.apache.maven.foo.aaa"));
+
+ assertFalse(groupTree.acceptedGroupId("org.apache.maven.bar"));
+ assertFalse(groupTree.acceptedGroupId("org.apache.maven.bar.aaa"));
+
+ assertTrue(groupTree.acceptedGroupId("org.apache.baz"));
+ assertFalse(groupTree.acceptedGroupId("org.apache.baz.aaa"));
Review Comment:
Nope, is not the `=`... simply, the logic to reject was coded in tree. What is needed is "fallback to root allow" and a change to make root always have allow (before it was `allow != null && allow`, which is `false` if `allow` was `null`), now is explicitly set to `false` or flipped if `*` present.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-1668: Add catch-all for group filter [maven-resolver]
Posted by "cstamas (via GitHub)" <gi...@apache.org>.
cstamas commented on code in PR #1694:
URL: https://github.com/apache/maven-resolver/pull/1694#discussion_r2571586014
##########
maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/filter/ruletree/GroupTreeTest.java:
##########
@@ -50,5 +50,59 @@ void smoke() {
assertTrue(groupTree.acceptedGroupId("org.apache.baz"));
assertFalse(groupTree.acceptedGroupId("org.apache.baz.aaa"));
+
+ assertFalse(groupTree.acceptedGroupId("not.in.list.but.uses.default"));
+ }
+
+ @Test
+ void smokeWithPositiveDefault() {
+ GroupTree groupTree = new GroupTree("root");
+ groupTree.loadNodes(Stream.of(
+ "# comment",
+ "",
+ "org.apache.maven",
+ "!=org.apache.maven.foo",
+ "!org.apache.maven.bar",
+ "=org.apache.baz",
+ "*"));
+ assertTrue(groupTree.acceptedGroupId("org.apache.maven"));
+ assertTrue(groupTree.acceptedGroupId("org.apache.maven.aaa"));
+
+ assertFalse(groupTree.acceptedGroupId("org.apache.maven.foo"));
+ assertTrue(groupTree.acceptedGroupId("org.apache.maven.foo.aaa"));
+
+ assertFalse(groupTree.acceptedGroupId("org.apache.maven.bar"));
+ assertFalse(groupTree.acceptedGroupId("org.apache.maven.bar.aaa"));
+
+ assertTrue(groupTree.acceptedGroupId("org.apache.baz"));
+ assertFalse(groupTree.acceptedGroupId("org.apache.baz.aaa"));
Review Comment:
Nope, is not the `=`... simply, the logic to reject was coded in tree. What is needed is "fallback to root allow" and a change to make root always have `allow` set (before it was `allow != null && allow`, which is `false` if `allow` was `null`), now root `allow` is explicitly set to `false` or flipped if `*` present.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-1668: Add catch-all for group filter [maven-resolver]
Posted by "cstamas (via GitHub)" <gi...@apache.org>.
cstamas commented on code in PR #1694:
URL: https://github.com/apache/maven-resolver/pull/1694#discussion_r2569938604
##########
maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/filter/ruletree/GroupTreeTest.java:
##########
@@ -50,5 +50,59 @@ void smoke() {
assertTrue(groupTree.acceptedGroupId("org.apache.baz"));
assertFalse(groupTree.acceptedGroupId("org.apache.baz.aaa"));
+
+ assertFalse(groupTree.acceptedGroupId("not.in.list.but.uses.default"));
+ }
+
+ @Test
+ void smokeWithPositiveDefault() {
+ GroupTree groupTree = new GroupTree("root");
+ groupTree.loadNodes(Stream.of(
+ "# comment",
+ "",
+ "org.apache.maven",
+ "!=org.apache.maven.foo",
+ "!org.apache.maven.bar",
+ "=org.apache.baz",
+ "*"));
+ assertTrue(groupTree.acceptedGroupId("org.apache.maven"));
+ assertTrue(groupTree.acceptedGroupId("org.apache.maven.aaa"));
+
+ assertFalse(groupTree.acceptedGroupId("org.apache.maven.foo"));
+ assertTrue(groupTree.acceptedGroupId("org.apache.maven.foo.aaa"));
+
+ assertFalse(groupTree.acceptedGroupId("org.apache.maven.bar"));
+ assertFalse(groupTree.acceptedGroupId("org.apache.maven.bar.aaa"));
+
+ assertTrue(groupTree.acceptedGroupId("org.apache.baz"));
+ assertFalse(groupTree.acceptedGroupId("org.apache.baz.aaa"));
+
+ assertTrue(groupTree.acceptedGroupId("not.in.list.but.uses.default"));
+ }
+
+ @Test
+ void smokeWithNegativeDefault() {
Review Comment:
No need
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-1668: Add catch-all for group filter [maven-resolver]
Posted by "cstamas (via GitHub)" <gi...@apache.org>.
cstamas commented on code in PR #1694:
URL: https://github.com/apache/maven-resolver/pull/1694#discussion_r2569938424
##########
src/site/markdown/remote-repository-filtering.md:
##########
@@ -181,6 +181,16 @@ Lines 1 and 2 are ignored. Line 3 means "allow `org.apache.maven` G and below".
only" (so `org.apache.maven.foo.bar` is allowed due first line). Line 5 means "disallow `org.apache.maven.indexer` and below"
and finally line 6 means "allow `org.apache.bar` ONLY" (so `org.apache.bar.foo` is NOT enabled).
+One can use one special entry "root" `*` (asterisk) to define the "default acceptance" (that without it
+defaults to REJECTED). Similarly, adding `!*` to file defines "default acceptance" of FALSE/REJECTED as well,
+and adding it to file changes nothing, as this is the default acceptance (but may serve some documentation purposes).
+Be aware: In case a line with single asterisk `*` is present, the whole logic of Group filter is getting inverted,
+hence there is no need to add "allowed entries" (they are allowed by default), but one can add "disallowed entries" by
+adding `!com.foo` and alike.
+
+Conflicting rules: rule parser is intentionally trivial, so in case of conflicting rules the "first wins" strategy is
+applied. Ideally, user should keep files sorted or handle them in a way one can detect conflicts in it.
+
Review Comment:
Is same. This is internally in fact a TREE
##########
maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/filter/ruletree/GroupTreeTest.java:
##########
@@ -50,5 +50,59 @@ void smoke() {
assertTrue(groupTree.acceptedGroupId("org.apache.baz"));
assertFalse(groupTree.acceptedGroupId("org.apache.baz.aaa"));
+
+ assertFalse(groupTree.acceptedGroupId("not.in.list.but.uses.default"));
+ }
+
+ @Test
+ void smokeWithPositiveDefault() {
Review Comment:
No need
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-1668: Add catch-all for group filter [maven-resolver]
Posted by "cstamas (via GitHub)" <gi...@apache.org>.
cstamas commented on code in PR #1694:
URL: https://github.com/apache/maven-resolver/pull/1694#discussion_r2571541543
##########
maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/filter/ruletree/GroupTreeTest.java:
##########
@@ -50,5 +50,59 @@ void smoke() {
assertTrue(groupTree.acceptedGroupId("org.apache.baz"));
assertFalse(groupTree.acceptedGroupId("org.apache.baz.aaa"));
+
+ assertFalse(groupTree.acceptedGroupId("not.in.list.but.uses.default"));
+ }
+
+ @Test
+ void smokeWithPositiveDefault() {
+ GroupTree groupTree = new GroupTree("root");
+ groupTree.loadNodes(Stream.of(
+ "# comment",
+ "",
+ "org.apache.maven",
+ "!=org.apache.maven.foo",
+ "!org.apache.maven.bar",
+ "=org.apache.baz",
+ "*"));
+ assertTrue(groupTree.acceptedGroupId("org.apache.maven"));
+ assertTrue(groupTree.acceptedGroupId("org.apache.maven.aaa"));
+
+ assertFalse(groupTree.acceptedGroupId("org.apache.maven.foo"));
+ assertTrue(groupTree.acceptedGroupId("org.apache.maven.foo.aaa"));
+
+ assertFalse(groupTree.acceptedGroupId("org.apache.maven.bar"));
+ assertFalse(groupTree.acceptedGroupId("org.apache.maven.bar.aaa"));
+
+ assertTrue(groupTree.acceptedGroupId("org.apache.baz"));
+ assertFalse(groupTree.acceptedGroupId("org.apache.baz.aaa"));
Review Comment:
We have a problem here.
Applicable rules:
```
=org.apache.baz
*
```
1st: "allow `org.apache.baz` ONLY"
2ns: default to ALLOW
So why is then `org.apache.baz.aaa` forbidden?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-1668: Add catch-all for group filter [maven-resolver]
Posted by "bmarwell (via GitHub)" <gi...@apache.org>.
bmarwell commented on code in PR #1694:
URL: https://github.com/apache/maven-resolver/pull/1694#discussion_r2569917633
##########
src/site/markdown/remote-repository-filtering.md:
##########
@@ -181,6 +181,16 @@ Lines 1 and 2 are ignored. Line 3 means "allow `org.apache.maven` G and below".
only" (so `org.apache.maven.foo.bar` is allowed due first line). Line 5 means "disallow `org.apache.maven.indexer` and below"
and finally line 6 means "allow `org.apache.bar` ONLY" (so `org.apache.bar.foo` is NOT enabled).
+One can use one special entry "root" `*` (asterisk) to define the "default acceptance" (that without it
+defaults to REJECTED). Similarly, adding `!*` to file defines "default acceptance" of FALSE/REJECTED as well,
+and adding it to file changes nothing, as this is the default acceptance (but may serve some documentation purposes).
+Be aware: In case a line with single asterisk `*` is present, the whole logic of Group filter is getting inverted,
+hence there is no need to add "allowed entries" (they are allowed by default), but one can add "disallowed entries" by
+adding `!com.foo` and alike.
+
+Conflicting rules: rule parser is intentionally trivial, so in case of conflicting rules the "first wins" strategy is
+applied. Ideally, user should keep files sorted or handle them in a way one can detect conflicts in it.
+
Review Comment:
Love it, great description.
One question popped into my mind: Does it make a differen WHERE I place the `*`?
So is this the same?
```
# not org.apache from this repo
!org.apache
# accept everything else
*
```
vs
```
# allow all, except...
*
# not org.apache from this repo
!org.apache
```
##########
maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/filter/ruletree/GroupTreeTest.java:
##########
@@ -50,5 +50,59 @@ void smoke() {
assertTrue(groupTree.acceptedGroupId("org.apache.baz"));
assertFalse(groupTree.acceptedGroupId("org.apache.baz.aaa"));
+
+ assertFalse(groupTree.acceptedGroupId("not.in.list.but.uses.default"));
+ }
+
+ @Test
+ void smokeWithPositiveDefault() {
+ GroupTree groupTree = new GroupTree("root");
+ groupTree.loadNodes(Stream.of(
+ "# comment",
+ "",
+ "org.apache.maven",
+ "!=org.apache.maven.foo",
+ "!org.apache.maven.bar",
+ "=org.apache.baz",
+ "*"));
+ assertTrue(groupTree.acceptedGroupId("org.apache.maven"));
+ assertTrue(groupTree.acceptedGroupId("org.apache.maven.aaa"));
+
+ assertFalse(groupTree.acceptedGroupId("org.apache.maven.foo"));
+ assertTrue(groupTree.acceptedGroupId("org.apache.maven.foo.aaa"));
+
+ assertFalse(groupTree.acceptedGroupId("org.apache.maven.bar"));
+ assertFalse(groupTree.acceptedGroupId("org.apache.maven.bar.aaa"));
+
+ assertTrue(groupTree.acceptedGroupId("org.apache.baz"));
+ assertFalse(groupTree.acceptedGroupId("org.apache.baz.aaa"));
+
+ assertTrue(groupTree.acceptedGroupId("not.in.list.but.uses.default"));
+ }
+
+ @Test
+ void smokeWithNegativeDefault() {
Review Comment:
Test case with `!*` at top (see other comment)
##########
maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/filter/ruletree/GroupTreeTest.java:
##########
@@ -50,5 +50,59 @@ void smoke() {
assertTrue(groupTree.acceptedGroupId("org.apache.baz"));
assertFalse(groupTree.acceptedGroupId("org.apache.baz.aaa"));
+
+ assertFalse(groupTree.acceptedGroupId("not.in.list.but.uses.default"));
+ }
+
+ @Test
+ void smokeWithPositiveDefault() {
Review Comment:
Test case with `*` at top (see other comment)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-1668: Add catch-all for group filter [maven-resolver]
Posted by "cstamas (via GitHub)" <gi...@apache.org>.
cstamas commented on code in PR #1694:
URL: https://github.com/apache/maven-resolver/pull/1694#discussion_r2571541543
##########
maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/filter/ruletree/GroupTreeTest.java:
##########
@@ -50,5 +50,59 @@ void smoke() {
assertTrue(groupTree.acceptedGroupId("org.apache.baz"));
assertFalse(groupTree.acceptedGroupId("org.apache.baz.aaa"));
+
+ assertFalse(groupTree.acceptedGroupId("not.in.list.but.uses.default"));
+ }
+
+ @Test
+ void smokeWithPositiveDefault() {
+ GroupTree groupTree = new GroupTree("root");
+ groupTree.loadNodes(Stream.of(
+ "# comment",
+ "",
+ "org.apache.maven",
+ "!=org.apache.maven.foo",
+ "!org.apache.maven.bar",
+ "=org.apache.baz",
+ "*"));
+ assertTrue(groupTree.acceptedGroupId("org.apache.maven"));
+ assertTrue(groupTree.acceptedGroupId("org.apache.maven.aaa"));
+
+ assertFalse(groupTree.acceptedGroupId("org.apache.maven.foo"));
+ assertTrue(groupTree.acceptedGroupId("org.apache.maven.foo.aaa"));
+
+ assertFalse(groupTree.acceptedGroupId("org.apache.maven.bar"));
+ assertFalse(groupTree.acceptedGroupId("org.apache.maven.bar.aaa"));
+
+ assertTrue(groupTree.acceptedGroupId("org.apache.baz"));
+ assertFalse(groupTree.acceptedGroupId("org.apache.baz.aaa"));
Review Comment:
We have a problem here.
Applicable rules:
```
=org.apache.baz
*
```
1st: "allow `org.apache.baz` ONLY"
2nd: default to ALLOW
So why is then `org.apache.baz.aaa` forbidden?
Seems the mod `=` causes some issues....
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-1668: Add catch-all for group filter [maven-resolver]
Posted by "cstamas (via GitHub)" <gi...@apache.org>.
cstamas commented on code in PR #1694:
URL: https://github.com/apache/maven-resolver/pull/1694#discussion_r2571586014
##########
maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/filter/ruletree/GroupTreeTest.java:
##########
@@ -50,5 +50,59 @@ void smoke() {
assertTrue(groupTree.acceptedGroupId("org.apache.baz"));
assertFalse(groupTree.acceptedGroupId("org.apache.baz.aaa"));
+
+ assertFalse(groupTree.acceptedGroupId("not.in.list.but.uses.default"));
+ }
+
+ @Test
+ void smokeWithPositiveDefault() {
+ GroupTree groupTree = new GroupTree("root");
+ groupTree.loadNodes(Stream.of(
+ "# comment",
+ "",
+ "org.apache.maven",
+ "!=org.apache.maven.foo",
+ "!org.apache.maven.bar",
+ "=org.apache.baz",
+ "*"));
+ assertTrue(groupTree.acceptedGroupId("org.apache.maven"));
+ assertTrue(groupTree.acceptedGroupId("org.apache.maven.aaa"));
+
+ assertFalse(groupTree.acceptedGroupId("org.apache.maven.foo"));
+ assertTrue(groupTree.acceptedGroupId("org.apache.maven.foo.aaa"));
+
+ assertFalse(groupTree.acceptedGroupId("org.apache.maven.bar"));
+ assertFalse(groupTree.acceptedGroupId("org.apache.maven.bar.aaa"));
+
+ assertTrue(groupTree.acceptedGroupId("org.apache.baz"));
+ assertFalse(groupTree.acceptedGroupId("org.apache.baz.aaa"));
Review Comment:
Nope, is not the `=`... simply, the logic to reject was coded in tree. What is needed is "fallback to root allow" and a change to make root always have `allow` set (before it was `allow != null && allow`, which is `false` if `allow` was `null`), now is explicitly set to `false` or flipped if `*` present.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-1668: Add catch-all for group filter [maven-resolver]
Posted by "cstamas (via GitHub)" <gi...@apache.org>.
cstamas merged PR #1694:
URL: https://github.com/apache/maven-resolver/pull/1694
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-1668: Add catch-all for group filter [maven-resolver]
Posted by "cstamas (via GitHub)" <gi...@apache.org>.
cstamas commented on code in PR #1694:
URL: https://github.com/apache/maven-resolver/pull/1694#discussion_r2569948672
##########
src/site/markdown/remote-repository-filtering.md:
##########
@@ -181,6 +181,16 @@ Lines 1 and 2 are ignored. Line 3 means "allow `org.apache.maven` G and below".
only" (so `org.apache.maven.foo.bar` is allowed due first line). Line 5 means "disallow `org.apache.maven.indexer` and below"
and finally line 6 means "allow `org.apache.bar` ONLY" (so `org.apache.bar.foo` is NOT enabled).
+One can use one special entry "root" `*` (asterisk) to define the "default acceptance" (that without it
+defaults to REJECTED). Similarly, adding `!*` to file defines "default acceptance" of FALSE/REJECTED as well,
+and adding it to file changes nothing, as this is the default acceptance (but may serve some documentation purposes).
+Be aware: In case a line with single asterisk `*` is present, the whole logic of Group filter is getting inverted,
+hence there is no need to add "allowed entries" (they are allowed by default), but one can add "disallowed entries" by
+adding `!com.foo` and alike.
+
+Conflicting rules: rule parser is intentionally trivial, so in case of conflicting rules the "first wins" strategy is
+applied. Ideally, user should keep files sorted or handle them in a way one can detect conflicts in it.
+
Review Comment:
So, due this, any ordering/permutation of following lines:
```
org.apache
org.eclipse
org.codehaus
```
will allways result in same tree:
```
org
/ | \
apache eclipse codehaus
```
each line is interpreted as "path" from root, and just the `*` is a special path (denoting root)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-1668: Add catch-all for group filter [maven-resolver]
Posted by "cstamas (via GitHub)" <gi...@apache.org>.
cstamas commented on code in PR #1694:
URL: https://github.com/apache/maven-resolver/pull/1694#discussion_r2571586014
##########
maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/filter/ruletree/GroupTreeTest.java:
##########
@@ -50,5 +50,59 @@ void smoke() {
assertTrue(groupTree.acceptedGroupId("org.apache.baz"));
assertFalse(groupTree.acceptedGroupId("org.apache.baz.aaa"));
+
+ assertFalse(groupTree.acceptedGroupId("not.in.list.but.uses.default"));
+ }
+
+ @Test
+ void smokeWithPositiveDefault() {
+ GroupTree groupTree = new GroupTree("root");
+ groupTree.loadNodes(Stream.of(
+ "# comment",
+ "",
+ "org.apache.maven",
+ "!=org.apache.maven.foo",
+ "!org.apache.maven.bar",
+ "=org.apache.baz",
+ "*"));
+ assertTrue(groupTree.acceptedGroupId("org.apache.maven"));
+ assertTrue(groupTree.acceptedGroupId("org.apache.maven.aaa"));
+
+ assertFalse(groupTree.acceptedGroupId("org.apache.maven.foo"));
+ assertTrue(groupTree.acceptedGroupId("org.apache.maven.foo.aaa"));
+
+ assertFalse(groupTree.acceptedGroupId("org.apache.maven.bar"));
+ assertFalse(groupTree.acceptedGroupId("org.apache.maven.bar.aaa"));
+
+ assertTrue(groupTree.acceptedGroupId("org.apache.baz"));
+ assertFalse(groupTree.acceptedGroupId("org.apache.baz.aaa"));
Review Comment:
Nope, is not the `=`... simply, the logic to refuse was coded in tree. What is needed is "fallback to root allow" and a change to make root always have allow (before it was `allow != null && allow`, which is `false` if `allow` was `null`), now is explicitly set to `false` or flipped if `*` present.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-1668: Add catch-all for group filter [maven-resolver]
Posted by "cstamas (via GitHub)" <gi...@apache.org>.
cstamas commented on code in PR #1694:
URL: https://github.com/apache/maven-resolver/pull/1694#discussion_r2571586014
##########
maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/filter/ruletree/GroupTreeTest.java:
##########
@@ -50,5 +50,59 @@ void smoke() {
assertTrue(groupTree.acceptedGroupId("org.apache.baz"));
assertFalse(groupTree.acceptedGroupId("org.apache.baz.aaa"));
+
+ assertFalse(groupTree.acceptedGroupId("not.in.list.but.uses.default"));
+ }
+
+ @Test
+ void smokeWithPositiveDefault() {
+ GroupTree groupTree = new GroupTree("root");
+ groupTree.loadNodes(Stream.of(
+ "# comment",
+ "",
+ "org.apache.maven",
+ "!=org.apache.maven.foo",
+ "!org.apache.maven.bar",
+ "=org.apache.baz",
+ "*"));
+ assertTrue(groupTree.acceptedGroupId("org.apache.maven"));
+ assertTrue(groupTree.acceptedGroupId("org.apache.maven.aaa"));
+
+ assertFalse(groupTree.acceptedGroupId("org.apache.maven.foo"));
+ assertTrue(groupTree.acceptedGroupId("org.apache.maven.foo.aaa"));
+
+ assertFalse(groupTree.acceptedGroupId("org.apache.maven.bar"));
+ assertFalse(groupTree.acceptedGroupId("org.apache.maven.bar.aaa"));
+
+ assertTrue(groupTree.acceptedGroupId("org.apache.baz"));
+ assertFalse(groupTree.acceptedGroupId("org.apache.baz.aaa"));
Review Comment:
Nope, is not the `=`... simply, the logic to refuse was coded in tree. What is needed is "fallback to root allow" and a change to make root always have allow (before it was allow != null && allow, which is `false` is it was null), now is explicitly set to `false` or flipped if `*` present.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org