简体   繁体   English

如何为intellij添加scala-test支持

[英]how to add scala-test support to intellij

How do I install scala-test with intellij. 如何使用intellij安装scala-test。 The video on the intellij website shows them adding a library dependency with scala-test showing up on the list. intellij网站上的视频显示他们添加了一个库依赖项,scala-test显示在列表中。 I don't have that however as I'll need to install scala-test somehow first. 我没有那个,因为我需要先安装scala-test。 The quickstart on the scala website just seems to have a link to a jar file. scala网站上的快速入门似乎有一个jar文件的链接。 Do I configure the IDE in some way to point to that jar file as a global library? 我是否以某种方式配置IDE以将该jar文件指向为全局库?

No need for a global library. 不需要全球图书馆。 Intellij IDEA supports adding libraries to your project directly from Maven. Intellij IDEA支持直接从Maven向您的项目添加库。 Here's how: 这是如何做:

  1. Go to File -> Project Structure 转到文件 - >项目结构
  2. Select the Dependencies tab 选择“依赖关系”选项卡
  3. Click the + sign at the bottom to create a new library 单击底部的+号以创建新库
  4. Choose "New Library" and seleect "From Maven" to add a new library from the public Maven repository 选择“New Library”并选择“From Maven”从公共Maven存储库添加一个新库

This brings up a search dialog which you can use to find the Maven dependency you want. 这将打开一个搜索对话框,您可以使用它来查找所需的Maven依赖项。 Try searching for "org.scalatest:scalatest" to get the list of scalatest libraries. 尝试搜索“org.scalatest:scalatest”以获取最新的库列表。

To install the latest version of ScalaTest and its dependencies in IntelliJ IDEA 2016.3.2 , you need: 要在IntelliJ IDEA 2016.3.2中安装最新版本的ScalaTest及其依赖项,您需要:

  1. Visit http://www.scalatest.org/install (section To include ScalaTest 3.0.1 in your Maven project ) to fetch a list of reqiered libraries full names with the following structure {groupId}:{artifactId}:{version} , eg 访问http://www.scalatest.org/install (部分To include ScalaTest 3.0.1 in your Maven project )以获取具有以下结构{groupId}:{artifactId}:{version}全名的列表{groupId}:{artifactId}:{version} ,例如

    • org.scalactic:scalactic_2.11:3.0.1
    • org.scalatest:scalatest_2.11:3.0.1

      Make sure that libraries names contain a Scala version you use in you project, ie above libraries are compatible with Scala 2.11 and not working with the new 2.12 version . 确保库名称包含您在项目中使用的Scala版本,即上面的库与Scala 2.11兼容而不使用新的2.12版本

  2. Go to FileProject Structure... or press Ctrl + Alt + Shift + S (Windows): 转到FileProject Structure...或按Ctrl + Alt + Shift + S (Windows):
    主菜单

  3. Go to Project Settings | Modules 转到Project Settings | Modules Project Settings | Modules section and click on Dependencies tab. 单击Project Settings | Modules部分,然后单击Dependencies选项卡。 Then click +2 Library...From Maven... : 然后单击+ ⇒2Library 2 Library...From Maven...
    项目结构对话框

  4. Type in the full library name to install, then click Search button (or press Shift + Enter ), select the library you need and click OK : 输入要安装的完整库名称,然后单击“ Search按钮(或按Shift + Enter ),选择所需的库,然后单击“ OK
    下载对话框

  5. Repeat steps 3 and 4 until all dependencies are installed. 重复步骤3和4,直到安装所有依赖项。

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

相关问题 Scala测试与读取文件有问题 - Scala-test having issues with read file 如何在scala-test中获取正在运行的测试的上下文? 是否有像TestNG中的ITestContext这样的东西来获取这些信息? - How to get the context of the running tests in scala-test ? Is there anything like ITestContext as in TestNG to get those information? Intellij IDEA - 无法为 Scala 添加框架支持 - Intellij IDEA - Cannot add framework support for Scala Intellij Idea为现有Java项目添加了Scala支持 - Intellij Idea add Scala support to existing Java project Scala:如何在Intellij中创建单元测试用例 - Scala : How to create Unit test case in Intellij 如何在IntelliJ Idea上启用Scala插件typsafe hocon支持 - How to Enable Scala plugin typsafe hocon support on IntelliJ Idea 如何在IntelliJ(Scala插件)​​中将其他Scala项目添加为依赖项 - How to add other Scala project as dependencies in IntelliJ (Scala Plugin) Scala 3 支持 IntelliJ 社区版 - Scala 3 Support For IntelliJ Community Edition 如何使IntelliJ Scala插件运行单元测试,或者如何告诉IntelliJ文件是单元测试代码? - How to make IntelliJ Scala plugin run the unit test, or how to teach IntelliJ that a file is a unit test code? 如何为摩纳哥编辑器添加 scala 语言支持 - How to add scala language support for monaco editor
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM