jdeps是一个Java类依赖分析工具,它是一个命令行工具,用于显示给定Java类文件的包级别或类级别依赖关系。输入的类可以是一个.class文件的路径名,一个目录,一个jar文件,或者是一个完全限定的类名来分析所有的类文件。
"jdeps"自jdk 8以来已经包含在jdk安装中,并且它由"%java_home%\bin\jdeps.exe"程序文件表示。如果我们在"path"环境变量中包含了"%java_home%\bin"目录,我们将运行"jdeps --help"命令以查看所有选项的完整列表。
下面,我们可以通过使用"jdeps --help"命令来查看选项列表。
C:\Program Files\Java\jdk-9.0.4>jdeps --help
Usage: jdeps ]
can be a pathname to a .class file, a directory, a JAR file.
Possible options include:
-dotoutput
--dot-output Destination directory for DOT file output
-s -summary Print dependency summary only.
-v -verbose Print all class level dependences
Equivalent to -verbose:class -filter:none.
-verbose:package Print package-level dependences excluding
dependences within the same package by default
-verbose:class Print class-level dependences excluding
dependences within the same package by default
-apionly
--api-only Restrict analysis to APIs i.e. dependences
from the signature of public and protected
members of public classes including field
type, method parameter types, returned type,
checked exception types etc.
-jdkinternals
--jdk-internals Finds class-level dependences on JDK internal
APIs. By default, it analyzes all classes
on --class-path and input files unless -include
option is specified. This option cannot be
used with -p, -e and -s options.
WARNING: JDK internal APIs are inaccessible.
--check [,...
Analyze the dependence of the specified modules
It prints the module descriptor, the resulting
module dependences after analysis and the
graph after transition reduction. It also
identifies any unused qualified exports.
--generate-module-info
Generate module-info.java under the specified
directory. The specified JAR files will be
analyzed. This option cannot be used with
--dot-output or --class-path. Use
--generate-open-module option for open modules.
--generate-open-module
Generate module-info.java for the specified
JAR files under the specified directory as
open modules. This option cannot be used with
--dot-output or --class-path.
--list-deps Lists the dependences and use of JDK internal APIs.
--list-reduced-deps Same as --list-deps with not listing
the implied reads edges from the module graph
If module M1 depends on M2 and M3,
M2 requires public on M3, then M1 reading M3 is
implied and removed from the module graph.
-cp
-classpath
--class-path Specify where to find class files
--module-path
Specify module path
--upgrade-module-path
Specify upgrade module path
--system Specify an alternate system module path
--add-modules [,...]
Adds modules to the root set for analysis
-m
--module Specify the root module for analysis
--multi-release
Specifies the version when processing
multi-release jar files. should
be integer >= 9 or base.
Options to filter dependences:
-p
-package
--package Finds dependences matching the given package
name (may be given multiple times).
-e
-regex
--regex Finds dependences matching the given pattern.
--require Finds dependences matching the given module
name (may be given multiple times). --package,
--regex, --require are mutual exclusive.
-f -filter Filter dependences matching the given
pattern. If given multiple times, the last
one will be used.
-filter:package Filter dependences within the same package.
This is the default.
-filter:archive Filter dependences within the same archive.
-filter:module Filter dependences within the same module.
-filter:none No -filter:package and -filter:archive
filtering. Filtering specified via the
-filter option still applies.
Options to filter classes to be analyzed:
-include Restrict analysis to classes matching pattern
This option filters the list of classes to
be analyzed. It can be used together with
-p and -e which apply pattern to the dependences
-P -profile Show profile containing a package
-R -recursive Recursively traverse all run-time dependences.
The -R option implies -filter:none. If -p,
-e, -f option is specified, only the matching
dependences are analyzed.
-I --inverse Analyzes the dependences per other given options
and then find all artifacts that directly
and indirectly depend on the matching nodes.
This is equivalent to the inverse of
compile-time view analysis and print
dependency summary. This option must use
with --require, --package or --regex option.
--compile-time Compile-time view of transitive dependences
i.e. compile-time view of -R option.
Analyzes the dependences per other given options
If a dependence is found from a directory,
a JAR file or a module, all c*lasses in that
containing archive are analyzed.
-q - quiet Do not show missing dependences from
--generate-module-info output.
-version --version Version information
登录后复制
以上就是jdeps工具在Java 9中的重要性是什么?的详细内容,更多请关注每日运维网(www.mryunwei.com)其它相关文章!