英文:
IntelliJ: .class file outputs to src folder of submodule instead of project out folder when compiled via command line
问题
I'm an IntelliJ noob.
我是一个 IntelliJ 初学者。
I have a module with submodules, which contain submodules as well. When compiling class files from any submodule within IntelliJ, it outputs the .class file to the corresponding out folder of the parent module (as desired):
我有一个包含子模块的模块,这些子模块也包含子模块。在 IntelliJ 中从任何子模块编译类文件时,它会将 .class 文件输出到父模块的相应 out 文件夹中(如所需):
When compiled via "run" button in IntelliJ:
When compiled via IntelliJ
当通过 IntelliJ 中的 "运行" 按钮编译时:
However, when compiling the same file via the command line, the class files are generated within the src folder for that module:
然而,当通过命令行编译相同的文件时,类文件会生成在该模块的 src 文件夹内:
.class file outputs to src folder of submodule instead of project out folder when compiled via command line.
When compiled via command line
在通过命令行编译时,.class 文件输出到子模块的 src 文件夹中,而不是项目的 out 文件夹。
How can I get the java files compiled via command line to output to the same out folder as they do when compiled via intellij?
如何使通过命令行编译的 Java 文件输出到与在 IntelliJ 中编译时相同的 out 文件夹中?
Thanks for any ideas.
感谢任何建议。
I tried setting the dependencies of Lecture7... and LectureCode modules to DataStructures module and have the compiler output path to "inherit project compile output path" under module settings.
我尝试将 Lecture7... 和 LectureCode 模块的依赖设置为 DataStructures 模块,并在模块设置下将编译器输出路径设置为 "继承项目编译输出路径"。
英文:
I'm an IntelliJ noob.
I have a module with submodules, which contain submodules as well. When compiling class files from any submodule within IntelliJ, it outputs the .class file to the corresponding out folder of the parent module (as desired):
When compiled via "run" button in IntelliJ:
When compiled via IntelliJ
However, when compiling the same file via the command line, the class files are generated within the src folder for that module:
.class file outputs to src folder of submodule instead of project out folder when compiled via command line.
When compiled via command line
How can I get the java files compiled via command line to output to the same out folder as they do when compiled via intellij?
Thanks for any ideas.
I tried setting the dependencies of Lecture7... and LectureCode modules to DataStructures module and have the compiler output path to "inherit project compile output path" under module settings.
答案1
得分: 0
- 转到 "文件" -> "项目结构" -> "模块"。
- 选择您的模块。
- 选择路径。
- 在那里,您需要配置源代码和测试的输出路径。
英文:
- Go to "File" -> "Project Structure" -> "Modules".
- Select your module.
- Select Paths.
- There you have the configure the output path for your source code and tests.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论