IntelliJ: .class file outputs to src folder of submodule instead of project out folder when compiled via command line

huangapple go评论47阅读模式
英文:

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

  1. 转到 "文件" -> "项目结构" -> "模块"。
  2. 选择您的模块。
  3. 选择路径。
  4. 在那里,您需要配置源代码和测试的输出路径。
英文:
  1. Go to "File" -> "Project Structure" -> "Modules".
  2. Select your module.
  3. Select Paths.
  4. There you have the configure the output path for your source code and tests.

huangapple
  • 本文由 发表于 2023年5月26日 12:32:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/76337688.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定