Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8189320

(jdeps) Need jdeps output format easy for jlink --add-modules to use

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P3 P3
    • 10
    • tools
    • None
    • minimal
    • add/remove/modify command line option
    • JDK

      Summary

      jdeps output is not friendly for jlink --add-modules option to use. Provide a new option to print the module dependences in a comma-separated list.

      Problem

      jlink --add-modules argument takes a comma-separated list of root modules. An existing jdeps --list-deps output can be used to identify the modules required for an application but it is designed to assist developers to find the module dependences and also any JDK internal APIs that can be used to include in @modules in JDK regression tests and also --add-exports option to break into encapsulation as a temporary workaround to migrate to JDK 9. The primary usage for jdeps --list-deps is different and introducing a new option seems reasonable.

      Solution

      Provide a new jdeps --print-module-deps option that will print the module dependences in a comma-separated list. To create a custom image for myapp.jar, one can do:

      $ jlink --module-path jmods --add-modules $(jdeps --print-module-deps myapp.jar)

      A side note: jdeps is static analysis tool and so any module required due to reflection will have to be added to the jlink command explicitly. Similarly service providers should be specified to jlink --add-modules option

      Specification

        --list-deps                   Lists the module dependences.  It also prints
                                      any JDK internal API packages if referenced.
                                      This option does not show dependences on the
                                      class path or not found.
        --list-reduced-deps           Same as --list-deps with not listing
                                      the implied reads edges from the module graph.
                                      If module M1 reads M2, and M2 requires
                                      transitive on M3, then M1 reading M3 is implied
                                      and is not shown in the graph.
        --print-module-deps           Same as --list-reduced-deps with printing
                                      a comma-separated list of module dependences.
                                      This output can be used by jlink --add-modules
                                      in order to create a custom image containing
                                      those modules and their transitive dependences.
      
      

            mchung Mandy Chung (Inactive)
            mchung Mandy Chung (Inactive)
            Sundararajan Athijegannathan
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: