OpenJDK split package scanner
This project contains a proposal for OpenJDK split package scanner addition.
The diving force starting this tool was the lack of tooling to prepare existing class path based modules
for later migration to modules. For split packages with the current JDK, they will be shown by the
tool as of today, but not class path based modules so far.
jsplitpgkscan utility will search for split packages within all given
.jar files and the modules
known to the JDK itself and report them.
Build and run
To build the tool you need to have a actual JDK build that you can get from https://jdk.java.net/11, https://adoptopenjdk.net or other providers. Make sure that you have at least version jdk-11 installed.
To build use:
./gradlew clean build
After the build was successful you can now start it using:
java -p build/libs/jsplitpkgscan-1.1.0-SNAPSHOT.jar -m org.adoptopenjdk.jsplitpkgscan
The usage is as follows
Usage: jsplitpkgscan <options> <path ...>] <path> can be a pathname to a JAR/WAR/RAR file or exploded JAR/WAR/RAR file. Possible options include: -h -? --help Print this usage message -a Report all packages for each found JAR/RAR/WAR file or exploded directory -d <directory> Directory containing JAR/RAR/WAR files or exploded directories to scan (scans subdirectories as well) -f <file> File containing a list of JAR/RAR/WAR files or exploded directories to scan -p <package prefix> Package prefix to report only split packages that matches this prefix --dot-output <dir> Destination directory for DOT file output
In order to create your own distribution using jlink you can enter the following command
if you have
$JAVA_HOME/bin/jlink --module-path $JAVA_HOME/jmods:build/libs --add-modules jsplitpkgscan \ --launcher jsplitpkgscan=jsplitpkgscan --output /tmp/jsplitpkgscan
For using the tool from inside you’re code, you can access it looking it up a an
java.util.spi.ToolProvider implementation as follows:
int rc = ToolProvider.findFirst("jsplitpgkscan") .ifPresent(tool -> tool.run(System.out, System.err, "-h")
Create DOT graphic
To get a
.png graphic for any
.dot file output for directed graphs you could use:
dot -Tpng summary.dot -O -Gratio=0.5
If your experience problems due undirected graphs you could also use this command:
twopi -Tpng summary.dot -O -Gratio=0.5 -Goverlap=false
Contributions are always welcome.
This project is licensed under the GNU General Public License, version 2 with the Classpath Exception