0

I have 2 projects, when I list the dependencies of the first I get:

[INFO] com.onespatial.gothic:gothic-java:jar:5.16
[INFO] +- com.onespatial.tools.gde:gde-cfg:zip:5.16:provided
[INFO] +- com.onespatial.gothic:gothic-w32:jar:5.16:compile
[INFO] \- com.onespatial.gothic:gothic-lx86_64:jar:5.16:compile

which is correct. The gde-cfg is provided. However when I list the dependencies of the second project, which includes the above project, I get:

[INFO] +- com.onespatial.radius.studio:rswebmapservice:jar:classes:2.3.4-build-7-SNAPSHOT:compile
[INFO] |  +- com.onespatial.gothic:gothic-java:jar:5.16:compile
[INFO] |  +- com.onespatial.gothic:gothic-lx86_64:jar:5.16:compile
[INFO] |  +- com.onespatial.gothic:gothic-w32:jar:5.16:compile

The transitive dependency of gothic-java is not appearing in the tree (or when I use dependency:list). Can anyone explain why gde-cfg is not being listed above.

Marcus MacWilliam
  • 602
  • 1
  • 6
  • 24
  • The provided deps should be listed as deps by default, except if you played with `includeScope`. Which version of Maven you use? Which mvn dependency plugin version? What is the command you execute to get the output? – rlegendi Jun 10 '14 at 12:17
  • maven-dependency-plugin 2.8 and the command line is simply mvn dependency:tree – Marcus MacWilliam Jun 10 '14 at 12:31

1 Answers1

0

As described in the Maven docs, transitive provided dependencies are not added to the dependency tree. There is a bug report from 2006, with no progress since.

You are meant to declare all the dependencies you are using in your project, in the sense that if you are using classes from gde-cfg, you should declare it in your dependencies, unrelated to whether there is a transitive dependency on it.

The only case that I can think of where the dependency would be necessary without you not actually using any classes from gde-cfg, is if you are extending a class/interface from gothic-java, and this class/interface extends a class/interface from gde-cfg. In this case the class/interface would have to be present at compile time, which it is not in Maven’s current behaviour. The workaround would be to manually add a provided dependency to gde-cfg to your project.

cdauth
  • 6,171
  • 3
  • 41
  • 49