问题
I don't know if this is a bug or intended functionality, but the POM editor for m2Eclipse has a wonderful graph representation ('Dependency Graph' tab) and tree ('Dependency Heirarchy' tab) if the dependencies are in the dependency section all by themselves. However, when you move them into the 'dependencyManagement' node (useful for module based projects) these tabs no longer work.
Does anyone know if this is a bug, intended functionality, etc?
EDIT #1: The dependencies in the dependency management section are NOT declared outside of the dependency management section in the parent. They are there to share amongst the child modules; to keep consistency (there was some standard posted somewhere that we're modeling this on).
EDIT #2: The tooling works at the child module level. I am referring to it not working at the parent level.
TIA
回答1:
I have POMs with dependencies declared under dependencyManagement
and they are just shown as expected in the Dependency Graph and Dependency Hierarchy tabs.
For example, I have a parent POM with:
<dependencyManagement>
<dependencies>
<!-- SL4J API -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<!-- SLF4J JDK14 Binding -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${slf4j.version}</version>
</dependency>
...
</dependencyManagement>
And a child POM with:
<dependencies>
...
<!-- Logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</dependency>
...
</dependencies>
And the Dependency Graph of the child just works:
Are the dependencies you moved under dependencyManagement
actually also declared as dependencies? Can you show a simplified pom.xml
illustrating the problem?
The tooling works at the child module level. I am referring to it not working at the parent level.
Dependencies declared in the dependencyManagement
element are not dependencies
of the project (if I declare foo
in the dependencyManagement
, I'm still not depending on foo
). If the parent doesn't declare any dependencies
, there is nothing to show.
来源:https://stackoverflow.com/questions/4159008/m2eclipse-dependencymanagement-section-doesnt-show-graph