Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Won't Fix
-
Affects Version/s: 2.0
-
Fix Version/s: None
-
Component/s: analyze
-
Labels:None
-
Number of attachments :
Description
In a project which uses something like mockrunner that requires some other jars to run the tests, those dependencies are listed as "Unused dependencies" even though the scope is set to "test".
<!-- referenced in test code --> <dependency> <groupId>com.mockrunner</groupId> <artifactId>mockrunner</artifactId> <version>0.4</version> <scope>test</scope> </dependency> <!-- needed for test execution, but not referenced in code --> <dependency> <groupId>jboss</groupId> <artifactId>jboss-j2ee</artifactId> <version>4.0.2</version> <scope>test</scope> </dependency> <dependency> <groupId>org.mockejb</groupId> <artifactId>mockejb</artifactId> <version>0.6-beta2</version> <scope>test</scope> </dependency>
The analysis code uses ASM to check the actual bytecode for comparison. This means that things like constants and runtime only dependencies will show up as unused. There is a flag (http://maven.apache.org/plugins/maven-dependency-plugin/analyze-mojo.html#ignoreNonCompile) that you can set to ignore the test scope.