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 depende
If a dependency is provided why can't that dependency be inherited with the same scope so I don't have to declare it?
It is inherited with the same scope. Given the following parent pom.xml
:
4.0.0
com.stackoverflow.Q3597684
root
1.0-SNAPSHOT
Q3597684 - Root
pom
javax.servlet
servlet-api
2.5
provided
junit
junit
3.8.1
test
And the following pom.xml
that inherits from the root artifact:
4.0.0
root
com.stackoverflow.Q3597684
1.0-SNAPSHOT
child
war
Q3597684 - Child
Running mvn dependency:tree
from 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-api
is there, as expected.
Are you maybe (mis)using the dependencyManagement
section?