Maven adding dependencies not in pom file -
i defining module 2 dependencies in pom file, generated .classpath file(using mvn eclipse:eclipse) contains other dependencies also.
i checked dependencies of modules added in pom, not of them added.
so scenario is:
- project depends on project b
- project b depends on projects x, y , z
when run mvn eclipse:eclipse on project a, .classpath file contains project b , projects x , y, not z.
this not causing problems, expected behavior?
yes, expected behaviour. project b needs x, y , z work properly, these dependencies (called transitive dependencies) part of project.
see this detailed explanation of maven dependency resolution.
you can call mvn dependency:tree
or mvn dependency:list
command line see dependencies, including transitive ones.
if know depending on artifact, available @ runtime, case java ee libraries on application server, can mark them provided
in pom
:
<dependency> <groupid>group</groupid> <artifactid>artifact</artifactid> <version>1.0</version> <scope>provided</scope> </dependency>
these dependencies not included in resulting atrifact.
edit: please excuse poor reading skills :) have overseen 'not' before 'z'.
this may still normal behaviour if dependency z defined provided
or optional
flag set true
, or if excluded. see this maven's handling of optional , excluded dependencies.
if neither of these options applies, expect z there other dependencies. best way check run mvn dependency:tree
or mvn dependency:list
, grep output z.