The jar file provided by Maven repository does not include class files

389 Views Asked by At

I need to use BaseDetectorTest provided from one of Spotbugs extension library

I added the maven dependency from (FindBugs Test Utility)

But it does not include the BaseDetectorTest class file (Once Maven is updated, the jar file is added to the external libraries - but not the class file).

I am wondering why it happens.

My guess is "the Jar file provided by the repository is still being developed"

Could you teach me how to fix it?

1

There are 1 best solutions below

2
On

find-sec-bugs/findsecbugs-test-util/src/test/java/com/h3xstream/findbugs/test/BaseDetectorTest.java is a test class. .../src/test/... and ...Test.java are indicators for that. Test classes aren't included in a project's JAR (by the jar:jar goal of the Maven JAR Plugin which is the default binding for the package phase) but in a project's ...-tests.jar which is created by the jar:test-jar goal.

  1. On MvnRepository select a version tag, e.g. 1.9.0, then Files jar (2 KB) View All to find the ...-tests.jar. Use it with:
<dependency>
  <groupId>com.h3xstream.findsecbugs</groupId>
  <artifactId>findbugs-test-util</artifactId>
  <version>1.9.0</version>
  <classifier>tests</classifier>
</dependency>
  1. On Maven Central you can get a later version (1.11.0), select it and then Browse to find it. Use it with:
<dependency>
  <groupId>com.h3xstream.findsecbugs</groupId>
  <artifactId>findsecbugs-test-util</artifactId>
  <version>1.11.0</version>
  <classifier>tests</classifier>
</dependency>