How to ignore or fix the duplicate classes warning?

5.5k views Asked by At

I'm trying to use the Qulice code quality control tool.

When I run qulice:check on my project, I get the following errors:

[WARNING] Found duplicate and different classes in [junit:junit:4.8.2,org.mockito:mockito-all:1.9.5] :
[WARNING]   org.hamcrest.BaseDescription
[WARNING]   org.hamcrest.BaseMatcher
[WARNING]   org.hamcrest.CoreMatchers
[WARNING]   org.hamcrest.Description
[WARNING]   org.hamcrest.Factory
[WARNING]   org.hamcrest.Matcher
[WARNING]   org.hamcrest.SelfDescribing
[WARNING]   org.hamcrest.StringDescription
[WARNING]   org.hamcrest.core.AllOf
[WARNING]   org.hamcrest.core.AnyOf
[WARNING]   org.hamcrest.core.DescribedAs
[WARNING]   org.hamcrest.core.Is
[WARNING]   org.hamcrest.core.IsAnything
[WARNING]   org.hamcrest.core.IsEqual
[WARNING]   org.hamcrest.core.IsInstanceOf
[WARNING]   org.hamcrest.core.IsNot
[WARNING]   org.hamcrest.core.IsNull
[WARNING]   org.hamcrest.core.IsSame
[WARNING]   org.hamcrest.internal.ArrayIterator
[WARNING]   org.hamcrest.internal.SelfDescribingValue
[WARNING]   org.hamcrest.internal.SelfDescribingValueIterator

I tried to disable those checks, but according to Qulice GitHub, this feature isn't implemented yet.

What can I do in order to get rid of these errors?

1

There are 1 answers

0
yegor256 On BEST ANSWER

The best you can do is this:

<plugin>
  <groupId>com.qulice</groupId>
  <artifactId>qulice-maven-plugin</artifactId>
  <configuration>
    <excludes>
      <exclude>duplicatefinder:.*</exclude>
    </excludes>
  </configuration>
</plugin>

See how it's done in pom.xml of rultor, for example. You're basically disabling the entire duplicate finder check. There is no way to disable just one artifact, at the moment.

ps. In your specific case, you don't need to disable duplicate finder. Just use proper versions of JUnit, Mockito, and Hamcrest, see how it's done in jcabi-parent pom.xml.