我正在学习java9模块系统。下面是我为管理java9的模块和包而创建的目录。
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
出现此警告的原因是什么?我如何解决它?我想确认我的目录结构是否适合模块管理?

发布于 2021-05-07 23:40:16
问这个问题已经有很长一段时间了,但可能对某些人仍然有帮助。我也收到过一次同样的警告。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并再次运行该命令会有所帮助。
https://stackoverflow.com/questions/49426894
复制相似问题