简体   繁体   English

Intellij:设置远程主机映射:本地路径不在项目中

[英]Intellij: Setting Remote host Mappings: Local path is out of project

I am using Intellij IDea ultimate 15.我正在使用 Intellij IDea Ultimate 15。

I want to compile/test/deploy on a remote host.我想在远程主机上编译/测试/部署。 So this is what I did: 1. File -> New -> Project -> Empty Project -> Specify project name/location所以这就是我所做的: 1. 文件 -> 新建 -> 项目 -> 空项目 -> 指定项目名称/位置

  1. Preferences -> Deployment -> add host(Test SFTP connection successfully)首选项 -> 部署 -> 添加主机(测试 SFTP 连接成功)
  2. Modify mappings: set the Local path to the same as project location修改映射:将本地路径设置为与项目位置相同

Then it complains:然后它抱怨:

Local Path '[my local path]' is out of project本地路径“[我的本地路径]”不在项目中

The path is the project location that I set to, it exists, and I have the right permission.路径是我设置的项目位置,它存在,并且我有正确的权限。 So don't know why it complains.所以不知道为什么会抱怨。

Thanks for your time!谢谢你的时间!

I have just now done hit this problem myself, and came up with a solution.我刚刚自己解决了这个问题,并提出了解决方案。 The problem is that in an empty project, if you open the project tree, you will see that there are no directories in your project.问题是在一个空的项目中,如果打开项目树,你会看到你的项目中没有目录。

If you open a "static web page" project, for example, you will notice that the directory is now a part of your project.例如,如果您打开一个“静态网页”项目,您会注意到该目录现在是您项目的一部分。

try doing the same thing, but in a "static web" project and the error will not occur any more尝试做同样的事情,但在“静态网络”项目中,错误将不再发生

Configure your Projectdeployments and save this.配置您的 Projectdeployments 并保存它。 Pay attention to correct paths!注意正确的路径! Then open "Directories" in the "Settings".然后在“设置”中打开“目录”。 Mark the baseline of your project as "Resource root" (required) and the other folders (as example - adjust to the project) as Sources.将项目的基线标记为“Resource root”(必需),将其他文件夹(例如 - 适应项目)标记为 Sources。 Apply and the problem is solved.申请,问题就解决了。

在 Settings->Directories 下检查您要排除的文件夹是否未从项目中排除

In Project Settings (via File -> Project Structure) assign your local project path as a new module path.在项目设置(通过文件 -> 项目结构)中,将您的本地项目路径指定为新模块路径。 On apply your subdirectories will be included in the Project Structure.应用时,您的子目录将包含在项目结构中。

I just had the same problem: Preferences --> Directories --> choose your project directory from the Directory list --> in the Mark as pane, click +Add Content Root.我刚刚遇到了同样的问题:首选项 --> 目录 --> 从目录列表中选择您的项目目录 --> 在标记为窗格中,单击 + 添加内容根。 Worked for me.为我工作。

I have just come across this problem.我刚刚遇到这个问题。 And I resolved it with restart the Intellij-IDE.我通过重新启动 Intellij-IDE 解决了它。 And it works.....它有效......

In my case, with pycharm 2019.2 on Linux, the situation was that the project was opened in pycharm via a link (shortcut) in my home directory.就我而言,在 Linux 上使用 pycharm 2019.2 时,情况是该项目是通过我的主目录中的链接(快捷方式)在 pycharm 中打开的。

In Deployment Mapping, specifying the actual path (with the link path resolved) of a sub-directory within the project resulted in this error("Local path is out of project").在部署映射中,指定项目内子目录的实际路径(已解析链接路径)会导致此错误(“本地路径超出项目”)。

Supplying the unresolved path following the link(as used to open the project) resolved the issue.提供链接后未解析的路径(用于打开项目)解决了该问题。

The problem, it appears, is that the IDE simply checks if the local path specified in Deployment Mapping has the project root path as it's prefix (as a string; without the links/shortcuts being resolved to their actual paths).问题似乎是,IDE 只是检查部署映射中指定的本地路径是否具有项目根路径作为它的前缀(作为字符串;没有将链接/快捷方式解析为它们的实际路径)。

By the way, the Deployment option in the context menu for the project sub-folder also remained disabled (greyed out) until this issue got resolved.顺便说一下,项目子文件夹的上下文菜单中的部署选项也保持禁用(灰色),直到这个问题得到解决。

I used PHP Storm since 2013 and now still using then i were faced this issue many many times.我从 2013 年开始使用 PHP Storm,现在仍在使用,然后我多次遇到这个问题。

The problem is in your " .idea " directory.问题出在您的“ .idea ”目录中。 There're corupted "modules.xml" and "projectname.iml".有损坏的“modules.xml”和“projectname.iml”。

Solution: copy these files from other project, or just delete the .idea directory.解决方案:从其他项目复制这些文件,或者直接删除.idea目录。

Please note after you copied from other project you need to rename current project, reconfig langagues & frameworks settings.请注意,从其他项目复制后,您需要重命名当前项目,重新配置语言和框架设置。 It's stand-alone depend every project, it's does not have same contents normally它是独立的取决于每个项目,它通常没有相同的内容

make sure确保

"the local path:" () “本地路径:”()

is sub dir of your goland IDE current opened project dir.是 goland IDE 当前打开的项目目录的子目录。

if you opened a project, but config the local path with a new dir, this error occur如果您打开了一个项目,但使用新目录配置本地路径,则会发生此错误

I'm currently on PyCharm 2021.3 and ran into this issue.我目前在 PyCharm 2021.3 上遇到了这个问题。

Arno's solution is the closest, but perhaps outdated. Arno 的解决方案是最接近的,但可能已经过时。 In the current interface/GUI the steps are:在当前界面/GUI 中,步骤如下:

  1. Open Preferences打开Preferences
  2. Go to Project: <YOUR_PROJ_NAME> , then Project Structure转到Project: <YOUR_PROJ_NAME> ,然后是Project Structure
  3. Click the Add Content Root单击Add Content Root
  4. Navigate to your project's root directory and Open it导航到项目的根目录并Open

That should be it.应该是这样的。 It seems insane that you would need to do this, since you already did this when you opened the project.您需要这样做似乎很疯狂,因为您在打开项目时已经这样做了。 But, this is the solution.但是,这就是解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM