Computer >> Hướng Dẫn Máy Tính >  >> Lập Trình >> Java

Tầm quan trọng của công cụ jdeps trong Java 9?

jdeps là công cụ Java Class Dependency Analyzer, dòng lệnh hiển thị package-level hoặc class-level dependencies của file class Java cho trước. Input class có thể là đường dẫn file .class, directory, file jar, hoặc fully qualified class name để phân tích tất cả file class.

jdeps có trong cài đặt JDK từ JDK 8, file chương trình %java_home%\bin\jdeps.exe. Nếu %java_home%\bin có trong PATH, chạy jdeps --help xem tất cả tùy chọn.

Dưới đây danh sách tùy chọn bằng jdeps --help:

C:\Program Files\Java\jdk-9.0.4>jdeps --help
Usage: jdeps <options> <path ...>] <path> can be a pathname to a .class file, a directory, a JAR file.
Possible options include:
  -dotoutput <dir>   --dot-output <dir>     Destination directory for DOT file output
  -s                 -summary               Print dependency summary only.
  -v                 -verbose               Print all class level dependences
  -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...
  -jdkinternals        --jdk-internals     Finds class-level dependences on JDK internal APIs...
  --check <module-name>[,<module-name>...]  Analyze the dependence of the specified modules...
  --generate-module-info <dir>              Generate module-info.java under the specified directory...
  --generate-open-module <dir>              Generate module-info.java for the specified JAR files as open modules...
  --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...
  -cp <path>      -classpath <path>   --class-path <path>   Specify where to find class files
  --module-path <module path>              Specify module path
  --upgrade-module-path <module path>      Specify upgrade module path
  --system <java-home>                      Specify an alternate system module path
  --add-modules <module-name>[,<module-name>...] Adds modules to the root set for analysis
  -m <module-name>  --module <module-name>   Specify the root module for analysis
  --multi-release <version>                Specifies the version when processing multi-release jar files...
  Options to filter dependences:
  -p <pkg>      -package <pkg>   --package <pkg>     Finds dependences matching the given package name...
  -e <regex>    -regex <regex>   --regex <regex>     Finds dependences matching the given pattern...
  --require <module-name>                  Finds dependences matching the given module name...
  -f <regex>   -filter <regex>              Filter dependences matching the given pattern...
  -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...
  Options to filter classes to be analyzed:
  -include <regex>                         Restrict analysis to classes matching pattern...
  -P              -profile                 Show profile containing a package
  -R              -recursive               Recursively traverse all run-time dependences...
  -I              --inverse                Analyzes the dependences per other given options...
  --compile-time                           Compile-time view of transitive dependences...
  -q              - quiet                  Do not show missing dependences from --generate-module-info output.
  -version        --version                Version information