Skip to content

遇到的问题&易忘的点

IDEA

无法运行文件 (The file in the editor is not runnable)

IDEA不能自动对源代码识别出来src目录,要我们手动设置

选中 src > 右键 > Make Directory as > Source Root

无法compile&run

Q: 当点击 run 按钮时报错 the output path is not specified for module ooprehomeworkbalabala

截屏2024-09-09 19.34.45

同时,左侧没有 out 文件夹 (不过自己写的时候也是 run 之后才有的 out )

According to informatik01 : You have to define a path in the "Project compiler output" field in

File > Project Structure... > Project > Project compiler output

截屏2024-09-09 19.39.20

可是为什么跑完左边的目录依旧没有 out 文件夹,但是在本地有?路径设置的问题,下次注意设置到hw文件夹中即可

GitLab

接收作业

$ git clone git@gitlab.oo.buaa.edu.cn:oo_2024_homeworks/xxx.git

克隆远程文件夹,会直接建立好git存储库

提交作业

发现修改的都是在 ooprehomework... 里,而且这个文件夹只有 .java 文件

提交作业的流程:

进入 ooprehomework... 目录

1
2
3
$ git add src       # add the src folder
$ git commit -m "description"
$ git push

CheckStyle file

Q: When I reopen the downloaded Java src file, only to find "The Checkstyle rules could not be read"

截屏2024-09-09 20.20.50

according to @jshiell's response to this question: Project relative paths should just reparse the path to be project relative

我想起来自己移动了config文件,所以导致config文件失效,故重新选择路径,解决了Checkstyle问题

过程中发现修改了全局的Checkstyle文件后,对于project仍然不起作用,验证了"局部变量"优先原则:)本project的Checkstyle文件也需要修改

在IDEA中,command + , 只能修改当前文件的偏好,全局的偏好在: File > New Projects Setup > Settings for New Projects > Preferences for New Projects

本地未提示代码风格问题

Q: 本地完全无⚠️,然而提交得到问题

截屏2024-09-09 20.43.33

according to huanlema: 因为没有设置好Checkstyle文件 (注意 apply > OK)

查看提醒的位置:

方法一:老方法,会直接提醒

方法二:需要运行

截屏2024-09-10 11.14.04

Others

快捷键

Shift + F6 修改变量名

Command + Shift + / 多行注释

⇧⌃R 运行

规范 Commit Message

CSDN|idea--Git Commit Template插件的使用

比较输出

way1: 在线工具🔧: https://www.diffchecker.com/zh-Hans/

way2: IDEA 复制文本到剪切板

截屏2024-10-15 10.32.16

截屏2024-10-15 10.32.34

way3: 对比文件