使用IntelliJ IDEA配置Erlang开发环境

https://www.cnblogs.com/jasonduan/p/5175660.html

转自:http://blog.csdn.net/witton/article/details/50551022

Idea工具是目前我使用过的开发Erlang最好用的IDE,但其Erlang插件的官方教程太简陋,我就想自己做一个相对详细的教程。我们来看看如何使用IDEA配置一个开发Erlang的环境:

首先,我们需要安装Erlang的插件,如下图所示,点击Install JetBrains plugin按钮,安装Erlang插件。

安装好插件后,还需要配置一下Rebar,如下图所示:

然后再选中下图所示的复选框,选择了这两项,我们才能使用Rebar进行编译,并且可以调试

配置好上述环境后,我们就可以新建Erlang项目了,如下图所示,选择新建Erlang项目,选择项目的SDK,这里我选择的Erlang 18,然后给项目取名字。

项目建好后,需要建一个spider.app.src文件(spider是Application的名字)以及一个rebar.config,这样才能使用Rebar进行编译,其具体配置如下图所示:

配置好使用Rebar进行编译项目的相关文件后,就可以配置编译工具的参数 了,如上图所示,在点击红色区域内的“Edit configurations”进行配置的编辑,再进行如下图所示的操作,添加 “Erlang Rebar”配置项,修改配置的名称、添加编译的命令compile以及选择支持的模块。

配置好后,就可以编译了,完成后,会在Project中增加如下图所示的目录及相应的文件。

配置好编译设置后,我们需要如下图所示添加并配置Erlang的应用,注意添加应用开始的模块、函数,以及需要配置工作目录,否则不能运行。

此时我们就可以编译、运行Erlang项目了,也可以进行调试,但是目前我们修改了代码需要手动编译一次,才能生效进行调试运行。可以进行下图所示的设置在启动应用前引用另一个配置进行Rebar的编译,使修改的代码立即生效。

我们在编写代码的时候,很多时候是需要帮助的,如查看某个系统函数的参数及用 法,我们只需要将光标移动到函数名中,使用Ctrl+Q就可以查看。但这里一个问题,Erlang插件默认的配置是直接从互联网上进行搜索显示的,就像 VS的在线MSDN一样,如果网络状况不佳,就会导致显示很慢,IDEA表现得很卡。可以通过如下图所示的方法添加本地搜索目录,并把网络搜索路径删除, 这样设置后查阅帮助就会变得很快了。

通过上面的设置我们现在大功告成,终于可以随心所欲地进行编辑、编译、断点、调试了,如下图所示,我们可以断点,单步执行,查看A、B变量的值,以及查看程序的输出。

http://ignatov.github.io/intellij-erlang/

intellij-erlang

Erlang plugin for IntelliJ IDEA

Key features

  • Intelligent Editor for Erlang with code completion, syntax and error highlighting and code inspections
  • Code Navigation: project and file structure views, quick jumping between files, modules, functions and usages
  • Tools and frameworks integration: support for Eunit and Rebar
  • VCS Integrations: out-of-the-box support for Subversion, Git and Mercurial
  • Cross-platform: works on Windows, Mac OS X and Linux

Installation

  1. Download the latest IntelliJ IDEA build and install it
  2. Setup the latest version of Erlang plugin from Configure > Plugins > Browse Repositories... > Erlang
  3. Restart IntelliJ IDEA.
  4. Done! You can import your existing Erlang project or create the new one.

Donations

If you would like to make a donation you can use PayPal.

How-tos

User Interface

Very nice guide about IntelliJ user interface.

Erlang SDK setup

You need to specify a directory that contains bin directory with erl and erlc executables inside. 
Also that directory should contains releases dir inside. 
Some predefined paths:

  • /usr/lib/erlang (Linux)
  • /opt/local/lib/erlang (Mac Ports on Mac OS X)
  • /usr/local/Cellar/erlang/R*/lib/erlang (Homebrew on Mac OS X)

If something goes wrong you always may reopen the #31.

Rebar integration

First of all, you need to provide the right path to the Rebar executable (Settings > Erlang External Tools). 

Note for Mac OS X users. Please, check that the PATH for IntelliJ contains rebar executable.
For further information see Stackoverflow answer and #189 issue.

Note for Windows users. Please checkout how to install rebar for Windows.

After you have set your rebar path up you can create a new Rebar run configuration(Run > Edit run configurations...), 
use a little green button on the top left corner:

Or execute an existing one (Run > Run...

You may create run configuration for every command which Rebar supports, e.g. compile or clean, etc.

Skip dependencies checkbox adds skip_deps=true command for Rebar executable.

To run eunit tests with rebar you can either create a Rebar Eunit run configuration or use a right-click context menu item 'Run ...' or 'Create ...' having clicked on a module(s), a unit test or a generator function you want to run. 

Rebar-based Eunit test runner: 

To set rebar as a default build action make sure you have checked Compile project with rebar checkbox:

After that your project will be built with 'rebar compile' command when you run Build > Make Project. Compilation result: 

Project structure

In version 0.5 we've added additonal per-module configuration parameters(see Project Structure > Modules).
There you can setup your modules' include paths and global parse transformations.

Debugger

Version 0.5 introduces experimental Erlang debugger support.
In order to use debugger you need to have debug_info checkbox under Settings > Compiler > Erlang Compiler checked.
You also need an Erlang Application run configuration which will be used by debugger. Such configuration can be created by right-clicking on entry point function.

Then you can use this configuration to debug your program:

The debugger requires Erlang Port Mapper Daemon (epmd) to be running. If it's not up, a warning will be issued. To start the daemon run any Erlang node on your machine, for example with erl -sname foo -s init stop -noshell command.

使用IntelliJ IDEA配置Erlang开发环境相关推荐

  1. 如何使用 IntelliJ IDEA 2017 配置PHP开发环境 及项目搭建

    IntelliJ IDEA 2017 配置PHP开发环境 及项目搭建 本文适用于初学者利用 IntelliJ IDEA搭建 PHP 工程及 PHP开发环境,本人也是初学者,在学习中有所心得,特此罗列如 ...

  2. 在IntelliJ IDEA里配置Go开发环境

    文章目录 一.Go语言概述 1.Go 语言特色 2.Go 语言用途 二.下载Go安装包 三.安装Go开发工具 四.第一个Go程序 1.编写源程序HelloWorld.go 2.直接运行程序HelloW ...

  3. IntelliJ IDEA 2019 配置 PHP 开发环境及创建 PHP 项目

    目录 安装 appserv IntelliJ IDEA 2019 配置 PHP 开发环境 IntelliJ IDEA 2019 创建 PHP 项目 安装 appserv appserv-win32-2 ...

  4. 安装与配置Flutter开发环境

    这篇博客我们介绍了Flutter,并且对比了H5,React Native,Flutter. 由于Flutter是跨平台的开发框架,开发一次可以同时运行在Android和iOS上面,所以我们开发时最好 ...

  5. Flutter系列之在 macOS 上安装和配置 Flutter 开发环境

    本文为Flutter开发环境在macOS下安装全过程: 一.系统配置要求 想要安装并运行 Flutter,你的开发环境需要最低满足以下要求: 操作系统:macOS(64位) 磁盘空间:700 MB(不 ...

  6. IDEA2022 配置spark开发环境

    本人强烈建议在 linux环境下 学习 spark!!! Introduction Apache Spark是一个快速且通用的分布式计算引擎,可以在大规模数据集上进行高效的数据处理,包括数据转换.数据 ...

  7. 阿里云ACP企业级互联网架构ACP实验之本地配置EDAS开发环境

    精选30+云产品,助力企业轻松上云!>>> 实验概述 企业级分布式应用服务(Enterprise Distributed Application Service, 简称 EDAS)是 ...

  8. python开发工具及环境配置_python_在windows下安装配置python开发环境及Ulipad开发工具...

    最近开始学习Python,在网上寻找一下比较好的IDE.因为以前用C#做开发的,用Visual Studio作为IDE,鉴于用惯了VS这么强大的IDE,所以对IDE有一定的依赖性. Python的ID ...

  9. Go 学习笔记(1)— Ubuntu 系统 Go 环境搭建、VS Code 配置 Go 开发环境、VS Code 远程开发配置

    1. 安装说明 Ubuntu 下直接安装 Go 1.11 版本编译器时需要依赖 Go 1.4 版本.所以如果在使用 apt-get install go安装时参考以下链接安装:https://blog ...

最新文章

  1. 如何使用jQuery按名称选择元素?
  2. 使用ImitateLogin模拟登录百度
  3. 编写DLL所学所思(1)——导出函数
  4. Google 代码搜索
  5. 关于Hibernate
  6. 删除一行下方单元格上移_快速删除Excel工作表多余空单元格
  7. 【Computer Organization笔记11】多周期CPU
  8. php中result的值,PHP 返回所取得行中字段的值
  9. qwidget设置背景颜色_Python+PyQt编程示例:设置窗口背景色及分割条颜色
  10. JavaScript 将两个数组合并,且删除重复的值
  11. 使用React构建精简版本掘金(三)
  12. linux DSA 开发上手笔记(一)
  13. 苹果手机解压缩软件_照片压缩软件哪款好用?推荐5款好用的图片压缩软件
  14. QQ拼音输入法实属流氓软件
  15. 网页视频下载:怎么批量下载网页上的视频
  16. luogu4234 最小差值生成树
  17. 一个网站直接跳转引起的一些思考
  18. 蚌埠学院教务系统自动导入课程表到小米/Redmi手机小爱同学课程表使用说明
  19. 6-9.添加HLSL镜面高光
  20. Python网络爬虫之爬取微博热搜

热门文章

  1. mysql中的事务_mysql中的事务,你理解嘛?
  2. 路径规划之图规划算法(图片版)
  3. php rewrite重写,yaf 自定义重写路由rewrite
  4. python 加速方法_24种方法加速你的Python
  5. JSP 九大内置对象及作用域(源码刨析,建议收藏)
  6. Qt 设置窗体大小和背景颜色
  7. 《学习OpenCV3》第4章 图像和大型数组类型(持续更新)
  8. 解决Windows上编译PHP7.1拓展的错误
  9. 该如何来开发这个喜欢的功能呢?
  10. 【操作系统/OS笔记11】并发执行的必要性,产生的问题,原子操作,为什么引入锁机制,面包购买的类比