I make use of dependency POMs which I will then go and include into another projects as as dependency. The problem I am having is while it aggregates the POM with those dependencies, it appears when I declare dependencies of scope, provided, those aren’t included.
Is it possible to include provided dependencies in dependency POMs with a scope of provided? I often declare what APIs I need and then include the implementation as a runtime dependency.
It is inherited with the same scope. Given the following parent
pom.xml:And the following
pom.xmlthat inherits from the root artifact:Running
mvn dependency:treefrom the child gives the following output:$ mvn dependency:tree[INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'dependency'. [INFO] ------------------------------------------------------------------------ [INFO] Building Q3597684 - Child [INFO] task-segment: [dependency:tree] [INFO] ------------------------------------------------------------------------ [INFO] [dependency:tree {execution: default-cli}] [INFO] com.stackoverflow.Q3597684:child:war:1.0-SNAPSHOT [INFO] +- javax.servlet:servlet-api:jar:2.5:provided [INFO] \- junit:junit:jar:3.8.1:test [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------The provided
servlet-apiis there, as expected.Are you maybe (mis)using the
dependencyManagementsection?