微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

clion 工程打开选项 安全模式预览 Preview in Safe Mode 信任工程 Trust Project 简介

目录

Project security 项目安全

CMake,and Gradle projects security 和 Gradle 项目安全 

Open a project for the first time 第一次打开一个项目 

Open an existing project 打开一个现有的项目 

Startup tasks 启动任务 

Review the startup tasks 检查启动任务 

Trusted locations 可信位置 

Configure trusted locations 配置可信位置 


Project security 项目安全

Last modified: 13 August 2021 最后更改: 2021年8月13日

To prevent potential security risks,CLion lets you decide how to open a project if you're not sure about its source. CLion warns you about tasks or configurations that will be executed during the opening process and lets you configure sources that you can trust.

为了防止潜在的安全风险,如果您不确定项目的源代码,CLion 允许您决定如何开放项目。CLion 警告您将在开放过程中执行的任务或配置,并允许您配置可信任的源。

CMake,and Gradle projects security 和 Gradle 项目安全

When you open a CMakeMakefile,or Gradle project,CLion executes its build scripts during the loading process that may potentially contain the untrusted code.

当您打开一个 CMake、 Makefile 或 Gradle 项目时,CLion 在加载过程中执行其构建脚本,这些脚本可能包含不可信的代码

Open a project for the first time 第一次打开一个项目

When you try to open a CMake,or Gradle project from an unkNown source for the first time,CLion displays a warning and lets you decide how to proceed.

当您第一次尝试从未知来源打开一个 CMake、 Makefile 或 Gradle 项目时,CLion 会显示一个警告,让您决定如何继续。

Untrusted project

 You can select one of the following actions:

你可以选择以下操作之一:

  • Preview in Safe Mode: in this case CLion opens a project in a "preview mode" meaning you can browse the project's sources,but it might be unsafe to execute Gradle tasks,load and run CMake or Makefile targets.

    安全模式下的预览: 在这种情况下,CLion 以“预览模式”打开项目,这意味着您可以浏览项目的源代码,但是执行 Gradle 任务、加载并运行 CMake 或 Makefile 目标可能不安全。

    CLion displays a notification on top of the editor area,and you can click the Trust project link and load your project at any time.

    CLion 在编辑器区域的顶部显示一个通知,您可以单击 Trust project 链接并随时加载您的项目。

  • Trust Project: in this case,CLion opens and loads a project. That means build scripts are executed,project's plugins are resolved,dependencies are added,and so on.

    Trust Project: 在这种情况下,CLion 打开并加载一个项目。这意味着执行构建脚本,解析项目的插件添加依赖项,等等。

  • Don't Open: in this case CLion cancels the action.

    不要打开: 在这种情况下,CLion 取消操作。

To trust the source from which you are trying to open a project,select the Trust projects in option. The next time you open a project from this directory,it will be opened and loaded automatically.

若要信任要打开项目的源,请选择“信任项目”选项中的“信任项目”。下次从这个目录打开一个项目时,它将被自动打开并加载。

Open an existing project 打开一个现有的项目

If a project you are planning to open was created on a different machine and contains the .idea directory,CLion opens your project in the IDE automatically as if you chose the Preview in Safe Mode action. CLion doesn't execute build scripts,resolve project's plugins,or add any dependencies. However,you still can browse the project's sources and open them in the editor.

如果您计划打开的项目是在不同的机器上创建的,并且包含。在 idea 目录中,CLion 会自动在 IDE 中打开项目,就像您选择了安全模式下的预览操作一样。不执行构建脚本,不解析项目的插件,也不添加任何依赖项。但是,您仍然可以浏览项目的源代码并在编辑器中打开它们。

If you try to reload the project or execute targets in case of CMake or Makefile,or run Gradle tasks using menu items,dedicated tool windows,or the Run Anything window,CLion will prompt you to confirm that you trust the project before proceeding.

如果您尝试在使用 CMake 或 Makefile 时重新加载项目或执行目标,或使用菜单项、专用工具窗口或 Run Anything 窗口运行 Gradle 任务,CLion 将提示您在继续执行之前确认您信任该项目。

CLion also displays an editor notification stating that the project is untrusted.

CLion 还显示一个编辑器通知,说明该项目是不可信的。

Cl trust cmake editor notification

If you trust the source,click Trust project and load it.

如果信任源,请单击“信任项目”并加载它。

Cl trust cmake load

For CMake projects,CLion will open the CMake Profile Wizard.

对于 CMake 项目,CLion 将打开 CMake 配置文件向导。

You can also add the source to the trusted locations,so the next time you open your project,CLion will trust it implicitly.

您还可以将源代码添加到受信任位置,因此下次打开项目时,CLion 将隐式地信任它。

Startup tasks 启动任务

When you open a project created on a different machine,it might contain some scripts or tasks that are executed during the opening process. If such tasks are found,CLion displays a notification suggesting that the code you are about to execute might be harmful.

当您打开在另一台计算机上创建的项目时,它可能包含在打开过程中执行的一些脚本或任务。如果找到这样的任务,CLion 将显示一个通知,表明您即将执行的代码可能有害。

You can review what tasks will be executed and modify the settings.

您可以检查将要执行的任务并修改设置。

Review the startup tasks 检查启动任务

  1. In the Settings/Preferences dialog Ctrl+Alt+S,go to Tools | Startup Tasks.

    在设置/首选项对话框中,Ctrl + Alt + s,进入工具 | 启动任务。

  2. On the Startup Tasks settings page,you can review and modify the startup tasks.

    在“启动任务设置”页上,可以查看和修改启动任务。

Trusted locations 可信位置

You can configure what sources CLion should consider safe and load such projects automatically during the opening process.

您可以配置 CLion 应该考虑的安全源,并在开放过程中自动加载此类项目。

You can add your home directory to the trusted locations to disable CLion's warnings about untrusted projects.

可以将主目录添加到受信任位置,以禁用 CLion 关于不受信任项目的警告。

Configure trusted locations 配置可信位置

  1. In the Settings/Preferences dialog Ctrl+Alt+S,go to Build,Execution,Deployment | Trusted Locations.

    在设置/首选项对话框 Ctrl + Alt + s 中,转到 Build,Execution,Deployment | Trusted Locations。

  2. On the Trusted Locations settings page,configure the local directories where the projects you consider trusted reside. Click OK to save the changes.

    在“受信任位置”设置页上,配置您认为受信任的项目所在的本地目录。单击 OK 保存更改。

    Trusted Locations

    The next time you open a project from one of those locations,CLion will automatically load the project.

    下次从这些位置之一打开项目时,CLion 将自动加载该项目。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐