Can't exclude some path from duplications analysis

Hi,

It’s probably a silly mistake on my side or something I did not understand properly from Narrowing the focus with an analysis scope, but I can’t seem to find a way to exclude xwiki-commons/xwiki-commons-core/xwiki-commons-jakartabridge at feature-deploy-jakarta · xwiki/xwiki-commons · GitHub from duplication analysis.

It’s a Maven build.

I tried the following:

But sonarcloud keep complaining.

Hey Thomas.

I believe your problem will be solved by moving the exclusion into the pom.xml for xwiki-commons-jakartabridge-servlet. There, a simple **/*.java should suffice.

Why? Well, for Maven projects, exclusions are applied for each module – so that’s once for the parent xwiki-commons-jakartabridge (but it contains no java files itself, only its children do, so nothing gets excluded), and then again for xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-common and xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet. While the latter two should inherit the exclusion settings you’ve set in the parent, the glob patterns are no longer valid when starting at the root of each of those modules.

I would have liked to test this out myself but I’ve had trouble building the project.

Thanks a lot @Colin, makes sense. Will try that.

But any idea why it does not work when set in the UI (not that I want to use the UI, but that was the most surprising one to me) ?

My theory here is that when you added the exclusion in the UI, you didn’t remove it from the pom.xml, and whatever is in the pom.xml always overrides what is set in the UI. docs

Any setting made in a configuration file will override settings made in the UI.

At the same time, I admit that I’m a bit rusty about how exclusions are applied here when modules are involved. I’m not sure that a project-level exclusion that includes a specific folder (the root of a module), will translate to an exclusion at the module level when inherited (or not) by that module. I’ll try and find a moment to run some tests.

That’s indeed, probably why. I missed this from the documentation, I was expecting all paths to be taken into account wherever they come from.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.