maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Barrie Treloar <>
Subject Re: Why is dependency:analyze lying to me?
Date Tue, 11 Feb 2014 21:41:29 GMT
On 12 February 2014 07:41, laredotornado-3 <> wrote:
> Hi,
> I'm using Maven 3.1.1 on Mac 10.9.1.  When I ran "mvn dependency:analyze" on
> my project, I got results that included:
>         [WARNING] Unused declared dependencies found:
>         ...
>         [WARNING]    junit:junit:jar:4.11:test
> So I commented out the above junit dependency in my pom (declared like so):
>         java.lang.NoSuchFieldError: NULL
>                 at org.junit.runners.ParentRunner.<init>(
>                 at
> org.junit.runners.BlockJUnit4ClassRunner.<init>(
>                 at
> org.springframework.test.context.junit4.SpringJUnit4ClassRunner.<init>(
> This isn't the only dependency that the analyze goal lists that wreaks havoc
> when I comment it out.  Is there another way to detect what dependencies are
> truly not needed by my project?

Unfortunately this stuff is not documented well enough in the plugin.
You're welcome to submit a patch!

Have a look at

I think Maven is missing a scope, it needs to break up test into two
phases; testCompile and testRuntime instead of having one scope which
means both.
This means that the analyze code can't tell what stuff is needed for
tests at compile time and what is needed at runtime.

If my memory serves me right, that would mean for your example that
Spring is a compile time dependency but junit would be a runtime
Hence the incorrect "Unused declared dependencies found" error.

I would manually ignore anything found in the test scope from the error list.
I never found the time to go hacking the plugin to work better - i.e.
if it is test scope it really can't tell the difference between unused
dependencies and shouldn't report them.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message