4
votes

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
I don't know Qulice - but what you show us here looks like a warning - not an error. Further, I'm not sire how excluding org.hamcrest:hamcrest-core is supposed to help when the warning states that the "duplicate" classes are in junit and mockito.Nir Alfasi
I have dependencies on JUnit and Mockito. Let's assume that both of them depend on org.hamcrest:hamcrest-core. Now org.hamcrest:hamcrest-core is included twice (one time for JUnit, one - for Mockito). If I exclude org.hamcrest:hamcrest-core in the dependency of JUnit (but not in that of Mockito), it will be included only one and in theory prevent he warning.Dmitrii Pisarenko
stackoverflow.com/questions/30680798/… looks at this. Also these jars are in test scope I assume?Himanshu Bhardwaj
@HimanshuBhardwaj That's a different warning (generated by a different plugin), which I fixed by excluding some dependencies. As already said in the question text, excluding the Hamcrest dependency doesn't fix these warnings.Dmitrii Pisarenko

1 Answers

2
votes

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.