java - 警告 : [path] the output directory is within an exploded module java 9

标签 java java-9 java-module

我正在学习 java 9 模块系统。这是我为管理 java 9 的模块和包而创建的目录。[下面列出的图形图像]

climesoft.widgets [module-1]
com.climesoft.main [module-2]
com.climesoft.math [module-3]
com.climesoft.string [module-4]

当我编译模块 math作为
javac -d mods/com.climesoft.math src/com.climesoft.math/module-info.java src/com.climesoft.math/com/climesoft/math/Math.java
warning: [path] the output directory is within an exploded module: mods/com.climesoft.math
1 warning

我正在尝试将模块输出管理为 mods/module-name/package (即 mods/com.climesoft.math/com/climesoft/math/Math.java )但我面临警告 warning: [path] the output directory is within an exploded module: mods/com.climesoft.math 1 warning
此警告的原因是什么,我该如何解决?我想确认我的目录结构是否适合模块管理?

enter image description here

最佳答案

很久没有问这个问题了,但也许对某人仍然有帮助。我曾经收到同样的警告。 exploded module表示该目录包含模块的解压缩内容。在我的情况下,提供给参数 -d 的父文件夹包含 module-info.java这是在此之前生成的。

┌ C:\dev\java\modules
└> tree /f
C:.
├───bin
│   │   module-info.class  <---- this file causes the warning
│   │
│   └───classes            <---- target directory in my command
├───lib
│       hello.jar
│
└───src
    │   module-info.java
    │
    └───com.example.module.hello
            HelloWorld.java

┌ C:\dev\java\modules
└> javac -d bin\classes src\com.example.module.hello\HelloWorld.java
warning: [path] the output directory is within an exploded module: bin\classes
1 warning
就我而言,删除 bin/module-info.class 会有所帮助。并再次运行该命令。

关于java - 警告 : [path] the output directory is within an exploded module java 9,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49426894/

相关文章:

java - Android: thread id=1: thread exiting with uncaught exception (group=0xb3d17b20)

java - 如何在JPA中选择一列并按该列进行分组?

Java将CMYK图像保存到文件

java - 无法运行 Oracle 提供的 Doclet 类

java - 什么是自动模块?

java - 使用 Java 9 模块,多个模块是否能够导出同一个包?

javaFX 应用程序错误 : No resources specified

java - 拼图: cannot find Kotlin symbols

带有 sendAsyncMulti/multiResponseAsync 的 Java 9 HttpClient

java - 运行我的模块化程序时,ModuleLayer 找不到我的资源,但它可以找到我的模块化 jar