我一直在使用 JLink 为各种 Spring Boot 应用程序创建最小的 JRE。通过反复试验找出所需的模块,我已经成功地手动完成了这项工作。成功执行此操作后,我一直在尝试使用 JDeps 自动执行此过程。
第一次尝试是为我的应用程序扫描构建的 Jar。我正在使用 Java 14 jdeps 来分析 Java 11 代码库。
jdeps --class-path BOOT-INF/classes --module-path BOOT-INF/lib/,${JAVA_HOME}/jmods --add-modules=ALL-MODULE-PATH --list-deps target/camel-account-sapi-0.0.2-SNAPSHOT.jar
这会导致几个未找到的依赖项。
Error: Missing dependencies: classes not found from the module path and classpath.
To suppress this error, use --ignore-missing-deps to continue.
camel-account-sapi-0.0.2-SNAPSHOT.jar
com.ms3.camelaccountsapi.CamelAccountSapiApplication -> org.springframework.boot.SpringApplication not found
com.ms3.camelaccountsapi.CamelAccountSapiApplication -> org.springframework.boot.autoconfigure.SpringBootApplication not found
com.ms3.camelaccountsapi.CamelAccountSapiApplication -> org.springframework.context.ConfigurableApplicationContext not found
com.ms3.camelaccountsapi.routes.GeneratedRoutesInterface -> org.apache.camel.builder.RouteBuilder not found
com.ms3.camelaccountsapi.routes.GeneratedRoutesInterface -> org.apache.camel.model.rest.RestDefinition not found
com.ms3.camelaccountsapi.routes.GeneratedRoutesInterface -> org.apache.camel.model.rest.RestOperationParamDefinition not found
com.ms3.camelaccountsapi.routes.GeneratedRoutesInterface -> …Run Code Online (Sandbox Code Playgroud)