3

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?

Glory to Russia
  • 17,289
  • 56
  • 182
  • 325
  • 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 Jun 08 '15 at 06:00
  • 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. – Glory to Russia Jun 08 '15 at 06:17
  • http://stackoverflow.com/questions/30680798/how-to-disable-duplicate-dependencies-check-in-qulice looks at this. Also these jars are in test scope I assume? – Himanshu Bhardwaj Jun 08 '15 at 06:25
  • @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. – Glory to Russia Jun 08 '15 at 06:36

1 Answers1

2

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.

yegor256
  • 102,010
  • 123
  • 446
  • 597