在stackoverflow上多次提到自动模块,但我找不到自动模块的完整,简洁和自给自足的定义.
那么,什么是自动模块?它是否导出所有包裹?它打开所有包裹吗?它是否读取所有其他模块?
我有3罐杰克逊图书馆
我成功地为core和annotation创建了module-info.java,并使用jdeps将它们转换为Named maodule.
对于数据绑定,我尝试了以下命令:
jdeps --generate-module-info.--module-path%JAVA_HOME%\ jomds; jackson.core; jackson.annotations existingmods\jackson-databind-2.8.10.jar
现在发生以下错误:
Missing dependence: .\jackson.databind\module-info.java not generated
Error: missing dependencies
com.fasterxml.jackson.databind.AnnotationIntrospector -> com.fasterxml.jackson.annotation.JsonCreator not found
com.fasterxml.jackson.databind.AnnotationIntrospector -> com.fasterxml.jackson.annotation.JsonCreator$Mode not found
com.fasterxml.jackson.databind.AnnotationIntrospector -> com.fasterxml.jackson.annotation.JsonFormat not found
com.fasterxml.jackson.databind.AnnotationIntrospector -> com.fasterxml.jackson.annotation.JsonFormat$Value not found
com.fasterxml.jackson.databind.AnnotationIntrospector -> com.fasterxml.jackson.annotation.JsonIgnoreProperties not found
com.fasterxml.jackson.databind.AnnotationIntrospector -> com.fasterxml.jackson.annotation.JsonIgnoreProperties$Value not found.
Run Code Online (Sandbox Code Playgroud)
如何为jackson-databind生成module-info.java?
我正在使用这个Github项目来接触Java 9中的新模块化功能.我想为项目添加依赖项并能够构建本机映像.但是,当我尝试向pom.xml添加新的依赖项,并将requires语句添加到module-info.java时,我从maven-jlink-plugin中收到以下错误:
Error: module-info.class not found for joda.time module
Run Code Online (Sandbox Code Playgroud)
我正在尝试使用它作为概念证明,我可以使用新的链接阶段部署图像,但自然我需要能够具有外部依赖性,我需要使用maven(工作约束).
对mod-jar/pom.xml的更改
...
<dependencies>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.9.9</version>
</dependency>
</dependencies>
...
Run Code Online (Sandbox Code Playgroud)
MOD-罐/ module-info.java
module com.soebes.nine.jar {
requires java.base;
requires joda.time;
exports com.soebes.example.nine.jar;
}
Run Code Online (Sandbox Code Playgroud)
日志:
[INFO] --- maven-jlink-plugin:3.0.0-alpha-1:jlink (default-jlink) @ mod-jlink ---
[INFO] Toolchain in maven-jlink-plugin: jlink [ /Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home/bin/jlink ]
[INFO] The following dependencies will be linked into the runtime image:
[INFO] -> module: com.soebes.nine.one ( /Users/sebastianrestrepo/Projects/jdk9-jlink-jmod-example/maven-example/mod-1/target/jmods/com.soebes.nine.one.jmod )
[INFO] -> module: com.soebes.nine.two ( /Users/sebastianrestrepo/Projects/jdk9-jlink-jmod-example/maven-example/mod-2/target/jmods/com.soebes.nine.two.jmod )
[INFO] -> module: com.soebes.nine.jar ( …Run Code Online (Sandbox Code Playgroud) java-9 ×3
java ×2
java-module ×2
jar ×1
java-platform-module-system ×1
jdeps ×1
jlink ×1
jodatime ×1
maven ×1