Content Selector shows nothing

Hi there,

we have a Problem on some content selectors - they stopped working cause they are actually showing nothing in browse view.

The thing is: the content-selector preview shows me the results i’m expecting but the nexus browser doesn’t show me anything - pretty strange i think.

content selector:

    format == "maven2" && 
    ( coordinate.groupId == "de.foo.bar" && coordinate.artifactId == "appxyz-api" ) 
    || 
    ( coordinate.groupId == "de.foo.bar" && coordinate.artifactId == "appxyz-rest-api-nodep" ) 
    || 
    ( coordinate.groupId == "de.foo.bar" && coordinate.artifactId == "appxyz-parent" )

If i test this with the preview everything looks nice - if i login with a user that has this content-selector in a role the browse view is empty.

I also tried with path statements it doesnt matter - if i change to format == "maven2" browse view is working again but if i add any other statement withh ‘and’ or ‘or’ i see nothing anymore.

We are using latest nexus 3.20.1 - and the user the role and selector hasn’t been touched since nearly a year and ind worked like expected on creation.

Any guesses on this ?

The coordinate based content selectors are deprecated, recommendation is to use path based selection:

path ^= "/de/foo/bar/appxyz-api"

You can also use regular expressions, which would let you use one content selector for the example you’ve given:

path ~= "/de/foo/bar/appxyz.*"

Once you’ve made that change, see here for how to get browse working:

Rich

Thx for your answer.
But as I stated the thing is not the coordinate based selector - I tried that also with path selectors.

The point is no selector is working with more than one condition. Preview shows the expected artifacts - browse view does not show anything.

I haven’t tried your stuff (on the road) but the documentation shows “and”/“or” and your example text shows “&&”/"||". Wondering if that has an impact.

It’d be nice to have an exact example of what you’re doing to test against IMO.
-Joe

Hi,
i tried both “&&” and “and” like in the examples - makes no difference.
I also have to add this whole Content Selector worked for half a year and stopped working last week for no reason. Nobody changed something in the nexus backend.

We have this user configured to only see/read some artifacts for customer-access, so i’ll try to show the exact and complete config for that, in the following posts (cause im not allowed to uploud more than one image :frowning: ):

If i change the selector for example to only ‘format == “maven2”’ browser view and preview show both all artifacts of the repo.

We also created a new user and rebuild the whole config -> same result.

You need to use a regular expression that allows directory listings, as the article here shows:

E.g.,

path ~= " /|/com/|/com/mycompany/|/com/mycompany/team-a/.*"

Or you can add this to allow browse of all directories:

path ~= ".*/"

ok, thank you that solved it.

But this does not explain why the content selector stopped working from one day to another.