How does mvn dependency:analyze work?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How does mvn dependency:analyze work?

Debraj Manna
Cross-posting from stackoverflow
<https://stackoverflow.com/questions/48315863/how-does-mvn-dependencyanalyze-work>

Can someone let me know how does mvn dependency:analyze work ? An output of mvn
dependency:analyze in one of my project shows

[WARNING] Used undeclared dependencies found:[WARNING]
org.apache.commons:commons-lang3:jar:3.4:compile[WARNING]
com.fasterxml.jackson.core:jackson-annotations:jar:2.8.0:compile...[WARNING]
Unused declared dependencies found:[WARNING]
org.springframework.boot:spring-boot-starter-test:jar:1.5.4.RELEASE:test[WARNING]
   org.springframework.restdocs:spring-restdocs-mockmvc:jar:1.1.3.RELEASE:test[WARNING]
   ch.qos.logback:logback-classic:jar:1.1.11:compile

Can some one let me know the following -

   - What does Used undeclared dependencies found denote? Does it mean that
   this is not declared in pom.xml dependencies but getting used in code
   and is included via some transitive dependencies?
   - Does Unused declared dependencies found check only for the
dependencies declared
   in pom.xml or it checks transitive dependencies as well?

Maven Version - 3.5.0
Reply | Threaded
Open this post in threaded view
|

Re: How does mvn dependency:analyze work?

Filipe Sousa
From
http://books.sonatype.com/mvnex-book/reference/optimizing-sect-dependency-plugin.html <http://books.sonatype.com/mvnex-book/reference/optimizing-sect-dependency-plugin.html>

"A good rule of thumb in Maven is to always declare explicit dependencies for classes referenced in your code.”

From time to time I run dependency:analyze -DignoreNonCompile=true -DoutputXML=true

> On 18 Jan 2018, at 07:31, Debraj Manna <[hidden email]> wrote:
>
> Cross-posting from stackoverflow
> <https://stackoverflow.com/questions/48315863/how-does-mvn-dependencyanalyze-work>
>
> Can someone let me know how does mvn dependency:analyze work ? An output of mvn
> dependency:analyze in one of my project shows
>
> [WARNING] Used undeclared dependencies found:[WARNING]
> org.apache.commons:commons-lang3:jar:3.4:compile[WARNING]
> com.fasterxml.jackson.core:jackson-annotations:jar:2.8.0:compile...[WARNING]
> Unused declared dependencies found:[WARNING]
> org.springframework.boot:spring-boot-starter-test:jar:1.5.4.RELEASE:test[WARNING]
>   org.springframework.restdocs:spring-restdocs-mockmvc:jar:1.1.3.RELEASE:test[WARNING]
>   ch.qos.logback:logback-classic:jar:1.1.11:compile
>
> Can some one let me know the following -
>
>   - What does Used undeclared dependencies found denote? Does it mean that
>   this is not declared in pom.xml dependencies but getting used in code
>   and is included via some transitive dependencies?
>   - Does Unused declared dependencies found check only for the
> dependencies declared
>   in pom.xml or it checks transitive dependencies as well?
>
> Maven Version - 3.5.0

Reply | Threaded
Open this post in threaded view
|

Re: How does mvn dependency:analyze work?

Debraj Manna
Thanks Filipe . Any thoughts about my second query


   - Does Unused declared dependencies found check only for the direct
   dependencies declared in pom.xml or it checks transitive dependencies as
   well?


On Thu, Jan 18, 2018 at 3:34 PM, Filipe Sousa <[hidden email]> wrote:

> From
> http://books.sonatype.com/mvnex-book/reference/optimizing-sect-dependency-
> plugin.html <http://books.sonatype.com/mvnex-book/reference/
> optimizing-sect-dependency-plugin.html>
>
> "A good rule of thumb in Maven is to always declare explicit dependencies
> for classes referenced in your code.”
>
> From time to time I run dependency:analyze -DignoreNonCompile=true
> -DoutputXML=true
>
> > On 18 Jan 2018, at 07:31, Debraj Manna <[hidden email]> wrote:
> >
> > Cross-posting from stackoverflow
> > <https://stackoverflow.com/questions/48315863/how-does-
> mvn-dependencyanalyze-work>
> >
> > Can someone let me know how does mvn dependency:analyze work ? An output
> of mvn
> > dependency:analyze in one of my project shows
> >
> > [WARNING] Used undeclared dependencies found:[WARNING]
> > org.apache.commons:commons-lang3:jar:3.4:compile[WARNING]
> > com.fasterxml.jackson.core:jackson-annotations:jar:2.8.0:
> compile...[WARNING]
> > Unused declared dependencies found:[WARNING]
> > org.springframework.boot:spring-boot-starter-test:jar:
> 1.5.4.RELEASE:test[WARNING]
> >   org.springframework.restdocs:spring-restdocs-mockmvc:jar:1.
> 1.3.RELEASE:test[WARNING]
> >   ch.qos.logback:logback-classic:jar:1.1.11:compile
> >
> > Can some one let me know the following -
> >
> >   - What does Used undeclared dependencies found denote? Does it mean
> that
> >   this is not declared in pom.xml dependencies but getting used in code
> >   and is included via some transitive dependencies?
> >   - Does Unused declared dependencies found check only for the
> > dependencies declared
> >   in pom.xml or it checks transitive dependencies as well?
> >
> > Maven Version - 3.5.0
>
>
Reply | Threaded
Open this post in threaded view
|

Re: How does mvn dependency:analyze work?

Anders Hammar
It only checks against direct dependencies for unused declared dependencies.
"declared dependencies" are direct dependencies.

/Anders (mobile)


Den 18 jan. 2018 14:45 skrev "Debraj Manna" <[hidden email]>:

Thanks Filipe . Any thoughts about my second query


   - Does Unused declared dependencies found check only for the direct
   dependencies declared in pom.xml or it checks transitive dependencies as
   well?


On Thu, Jan 18, 2018 at 3:34 PM, Filipe Sousa <[hidden email]> wrote:

> From
> http://books.sonatype.com/mvnex-book/reference/optimizing-sect-dependency-
> plugin.html <http://books.sonatype.com/mvnex-book/reference/
> optimizing-sect-dependency-plugin.html>
>
> "A good rule of thumb in Maven is to always declare explicit dependencies
> for classes referenced in your code.”
>
> From time to time I run dependency:analyze -DignoreNonCompile=true
> -DoutputXML=true
>
> > On 18 Jan 2018, at 07:31, Debraj Manna <[hidden email]> wrote:
> >
> > Cross-posting from stackoverflow
> > <https://stackoverflow.com/questions/48315863/how-does-
> mvn-dependencyanalyze-work>
> >
> > Can someone let me know how does mvn dependency:analyze work ? An output
> of mvn
> > dependency:analyze in one of my project shows
> >
> > [WARNING] Used undeclared dependencies found:[WARNING]
> > org.apache.commons:commons-lang3:jar:3.4:compile[WARNING]
> > com.fasterxml.jackson.core:jackson-annotations:jar:2.8.0:
> compile...[WARNING]
> > Unused declared dependencies found:[WARNING]
> > org.springframework.boot:spring-boot-starter-test:jar:
> 1.5.4.RELEASE:test[WARNING]
> >   org.springframework.restdocs:spring-restdocs-mockmvc:jar:1.
> 1.3.RELEASE:test[WARNING]
> >   ch.qos.logback:logback-classic:jar:1.1.11:compile
> >
> > Can some one let me know the following -
> >
> >   - What does Used undeclared dependencies found denote? Does it mean
> that
> >   this is not declared in pom.xml dependencies but getting used in code
> >   and is included via some transitive dependencies?
> >   - Does Unused declared dependencies found check only for the
> > dependencies declared
> >   in pom.xml or it checks transitive dependencies as well?
> >
> > Maven Version - 3.5.0
>
>