With Burningwave Tools, it is possible to perform dependency shrinking and also make applications created with old Java versions work on Java 9 and later versions. To adapt applications to Java 9 and later, you must create an application adapater and run it with JDK 9 or later. In this application adapter you must load, by using PathHelper, the JDK libraries the target application was developed with and pass to the method captureAndStore of the TwoPassCapturer component, as the first parameter, the name of the class of your application that contains the main method. In the example below, we're adapting a Java 8 Spring Boot application to Java 9 or later.
xxxxxxxxxx
ComponentSupplier componentSupplier = ComponentContainer.getInstance();
PathHelper pathHelper = componentSupplier.getPathHelper();
Collection<String> paths = pathHelper.getAllMainClassPaths();
if (JVMInfo.getVersion() > 8) {
paths.addAll(pathHelper.getPaths("dependencies-capturer.additional-resources-path"));
}
List<String> _paths = new ArrayList<>(paths);
Collections.sort(_paths);
Result result = TwoPassCapturer.getInstance().captureAndStore(
//Here you indicate the main class of your application
"com.springbootappadapter.SpringBootWebApplication",
args,
paths,
//Here you indicate the destination path where extracted
//classes and resources will be stored
System.getProperty("user.home") + "/Desktop/dependencies",
true,
//Here you indicate the waiting time after the main of your
//application has been executed. This is useful, for example,
//for spring boot applications to make it possible, once started,
//to run rest methods to continue extracting the dependencies
0L
);
result.waitForTaskEnding();