原文地址:http://www.summa-tech.com/blog/2011/04/12/a-visual-maven-dependency-tree-view/
The Maven dependency:tree is a helpful plugin that shows where all those jars are coming from in our Maven projects. The default output is text, and sometimes we want something more visual. There are two somewhat easy ways to accomplish this.
1. Using graphml output
Here are the basic steps to get a more visual dependency tree like the one showing below:
Since the version 2.1 the Dependency plugin supports different output formats, one of them the GraphML, which is an XML-based file format for graphs.
In you pom.xml you may want to add these lines under the build plugins section to make sure the latest version is used:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.2</version>
</plugin>
</plugins>
</build>
Use this command to generate the dependency tree, in graphml, saving to a dependency.graphml file:
mvn dependency:tree -DoutputType=graphml -Doutput=dependency.graphml
To visualize GraphML I use yEd Graph Editor which is a cool free visualization tool written in Java.
Now, open yED and select Open Document -> dependency.graphml > OK.
This will open the document, but all you see is some weird lines.
Maven Dependency tree not formatted in yED
By default yED will not format the graph, but it has many different formats that you can use. Two simple steps separates you from a nice graph:
1) Select Tools > Fit Note to Label … > OK
This should adjust the labels
2) Select Layout > Hierarchical > Orientation > Left to Right > OK
2. Using M2Eclipse plugin
M2Eclipse is a plugin developed by Sonatype. It complements nicely the use of Maven and provides a helpful dependency view.
Once you have the plugin installed (link at the bottom of the page), all you have to do is open the pom.xml and under the tabs select Dependency Hierarchy. On the left side you see the hierarchy with the 2nd, 3rd level jars brought to your project. On the right side is the resolved list. These are the jars that will be actually used in your project.
In case you don’t know, the words between brackets is the Maven dependency scope. Basically test is means it would be only used during test. Provided means that the dependency would be used to compile and execution of tests, but would not be included in the packaged file. Compile is the jars that would end up in you WAR, JAR or other packages as direct dependencies libraries.
Here you go, two ways to get a dependency tree that can be easily navigated and understood.
More info:
Maven Dependency Plugin http://maven.apache.org/plugins/maven-dependency-plugin
yED Graph Editor: http://www.yworks.com/en/products_yed_about.html
M2Eclipse Plugin: http://m2eclipse.sonatype.org/
Maven Dependency Scope: http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope
分享到:
相关推荐
maven-dependency-plugin-2.8.jar
maven-dependency-tree-1.2.jar
maven-dependency-tree-parser-1.0.6.jar,用于mvn depenency:tree的记录解析
然而,有时我们可能会遇到一些特定的依赖问题,比如在这个案例中,"Unresolved dependency: 'com.aspose:aspose:jar:19'",意味着在执行Maven构建时,Maven无法从配置的阿里云仓库中找到`com.aspose:aspose:jar:19`...
Aiming to give you a clear understanding of Maven’s functionality, this book focuses on specific case studies that shed light on highly useful Maven features which are often disregarded. The content ...
成功后,它将对它们进行依赖性检查并生成报告要求Python模块: & Maven:安装说明可在找到包含要运行的用于克隆项目的git命令repo.conf示例命令git clone https://github.com/elderstudios/uni-dvwa-spring.git ...
Maven更新问题 今天Maven在更新的时候发现一直更新不成功,总结下解决方法。 在apache-maven-3.5.2/conf/setting.xml中加入以下配置即可解决 alimaven aliyun maven ...
《Maven的Dependency详解》 在软件开发过程中,依赖管理是一项关键任务,尤其是在Java领域,Maven通过其强大的依赖管理机制简化了这一过程。Maven的Dependency是项目构建中的核心概念,它允许开发者声明项目所需的...
Maven是一个项目管理和构建自动化工具,主要服务于基于Java的软件开发项目。它由Apache软件基金会提供支持,并且是Apache项目的一部分。Maven的核心功能包括依赖管理、项目构建、文档生成和测试等。 ### Maven的...
本文将聚焦于"Maven依赖插件"(maven-dependency-plugin)的版本2.8及其在开源项目中的应用,特别是结合Cobertura插件进行代码覆盖率检查。 Maven依赖插件(maven-dependency-plugin)是Maven生态系统中的一个重要...
附件为:dubbox2.8.4 maven依赖文件。 使用方法:按照依赖关系,自行创建maven依赖文件夹后,将附件解压至指定文件夹即可使用。 文件夹目录:com/alibaba/dubbo/2.8.4/ <dependency> <groupId>...
**Maven的Dependency测试** 在Java开发中,Maven是一个不可或缺的构建工具,它通过管理项目的依赖关系,简化了项目的构建、编译和部署过程。本文将深入探讨Maven的Dependency测试方面,帮助开发者理解如何有效地...
maven-dependency-tree-1.0.jar maven-deploy-plugin-2.7.jar maven-deploy-plugin-2.8.1.jar maven-eclipse-plugin-2.9.jar maven-embedder-3.2.1-sources.jar maven-filtering-1.1.jar maven-install-plugin-2.3.1...
XJar-Maven-Plugin是对的一个Maven插件封装,实现可通过Maven命令或绑定在Maven的生命周期之中执行,从而更加便捷的方式集成了 。 GitHub: : 什么是XJar XJar是基于对JAR包内部资源的加密以及扩展ClassLoader来...
我们在IDEA的安装目录下找到 /plugins/maven/lib/maven2/conf 或者 /plugins/maven/lib/maven3/conf目录(如果两个都有建议都改掉),向其中的setting.xnl文件中的/标签下添加如下的仓库地址(这里以阿里云为例): ...
使用idea maven配置spark项目时遇到下面错误 Error:scalac: missing or invalid dependency detected while loading class file 'Tensor.class'. Could not access term mllib in package org.apache.spark, ...
标题“jodconverter2.2.2.jar Maven依赖包”涉及到的是一个Java开发中的关键组件,即JODConverter库的一个特定版本。JODConverter是一个开源的文档转换工具,它允许用户在Java应用程序中方便地将各种Office文档格式...
maven-dependency-tree-1.1-sources.jar
钉钉sdk-dependency-maven dingtalk 放到maven仓库的com目录路径下 <dependency> <groupId>DingTalk <artifactId>open-sdk <version>1.0.0 </dependency> 钉钉的无官方 <dependency> ,使用maven命令将jar...
`dependency-update-maven-plugin` 是一个针对Maven构建工具的插件,它专为自动化这个过程而设计。该插件能够检查项目中所有依赖项的最新版本,并生成一个合并请求,以便开发者可以方便地审查和更新这些依赖。 ...