Maven. Transitive dependencies

后端 未结 4 1950
时光说笑
时光说笑 2020-12-14 06:33

My project P depends on dependency A which depends on dependency B. My project\'s pom.xml file includes A as a dependency, and its jar is included in P\'s classpath. Howev

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-14 06:39

    If this dependency A has a compile scope - sure, it should have been downloaded and more over - made available in the classpath of the project. But if it had provided scope that would be the case, since provided deps would not be packaged with the application by Maven.

    Btw how are you running this project - not running in the proper way might cause such problems as well and this is a very good guess. For example - if you're using maven exec plugin - maven will setup properly the classpath for you, but otherwise - you should setup it yourself(or build a jar with dependencies with the assembly plugin).

提交回复
热议问题