在 intellij 项目中创建符号链接

Create symlink within intellij project

我正在尝试在我的 Intellij 项目中创建一个 symlink,我想 link index.html 从我的反应文件夹到我的模板文件夹。我正在使用这个命令:

ln -s react-app/build/index.html site/src/ratpack/templates/index.html

但是当我 运行 gradle 构建时我得到了错误

Could not list contents of /home/xxx/dev/football/site/src/ratpack/templates/index.html Couldnt follow symbolic link

我创建这个 symlink 是不是错了?我正在 运行 从我的项目的根目录中执行命令。

使用file 命令检查该文件是否存在并知道它是什么。

file /home/xxx/dev/football/site/src/ratpack/templates/index.html

如果存在,用unlink命令删除当前损坏的link,然后创建一个新的。我建议使用绝对路径而不是相对路径来创建符号 link 以避免你从哪里 运行 命令。

如果您按以下方式使用,则说明您正确使用了该命令:

ln -s target link_name