gpt4 book ai didi

java - 智能 : How to set default working directory?

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:44:49 24 4
gpt4 key购买 nike

我是一名从 Eclipse 迁移到 IntelliJ 的用户。

我的大多数项目都在项目的根目录中包含一个资源文件夹,在本例中是一个模块:

enter image description here.

上面目录下的fonts文件夹是代码用来加载渲染使用的字体的。问题在于,在 IntelliJ 中,编译目标是项目文件夹本身,因此未检测到字体。您可以通过手动编辑运行配置来解决这个问题,以便工作目录位于模块根目录中。

我的问题是,我能否以某种方式更改 IntelliJ,使每个项目默认具有此行为,而不必每次都手动执行?默认情况下,程序的目标工作目录始终是类所在模块的根文件夹。

提前致谢!

最佳答案

The problem is that in IntelliJ, the compilation target is the project folder itself

building项目/模块,IDE 将标记为 source/resource/generated source/test source 的文件夹中的所有文件/源包含到编译类路径中等类型。

另请注意,对于 Maven (Gradle) 项目,IDE 从 Maven pom.xml 文件中获取配置,包括编译器配置。默认情况下,Maven 不会处理(复制)源目录中的资源文件。您需要在 pom.xml 中对其进行显式配置,或者将资源文件移动到资源类型的文件夹中。

现在关于主要问题:

...manually editing the run configuration so that the working directory is in the module root.

My question is, can I somehow change IntelliJ to have this behavior by default for every project instead of having to manually do it every time?

您可以 change the Run/Debug Configuration template

关于java - 智能 : How to set default working directory?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56212815/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com