What are unused/undeclared dependencies in maven ? What to do with them ?

Posted by b7kich on Stack Overflow See other posts from Stack Overflow or by b7kich
Published on 2010-12-30T19:47:28Z Indexed on 2010/12/30 19:54 UTC
Read the original article Hit count: 256

Filed under:
|

Maven dependency:analyze complains about the dependencies in my project. How does it determine which are unused and which are undeclared ? What should I do about them ?

Example:

$ mvn dependency:analyze 
...
[WARNING] Used undeclared dependencies found:
[WARNING]    org.slf4j:slf4j-api:jar:1.5.0:provided
[WARNING]    commons-logging:commons-logging:jar:1.1.1:compile
[WARNING]    commons-dbutils:commons-dbutils:jar:1.1-osgi:provided
[WARNING]    org.codehaus.jackson:jackson-core-asl:jar:1.6.1:compile

...
[WARNING] Unused declared dependencies found:
[WARNING]    commons-cli:commons-cli:jar:1.0:compile
[WARNING]    org.mortbay.jetty:servlet-api:jar:2.5-20081211:test
[WARNING]    org.apache.httpcomponents:httpclient:jar:4.0-alpha4:compile
[WARNING]    commons-collections:commons-collections:jar:3.2:provided
[WARNING]    javax.mail:mail:jar:1.4:provided

Note: A lot of these dependencies are used in my runtime container and I declared them as provided to avoid having same library on the classpath twice with different versions.

© Stack Overflow or respective owner

Related posts about maven-2

Related posts about maven