简体   繁体   中英

how to add scala-test support to intellij

How do I install scala-test with intellij. The video on the intellij website shows them adding a library dependency with scala-test showing up on the list. I don't have that however as I'll need to install scala-test somehow first. The quickstart on the scala website just seems to have a link to a jar file. Do I configure the IDE in some way to point to that jar file as a global library?

No need for a global library. Intellij IDEA supports adding libraries to your project directly from 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

This brings up a search dialog which you can use to find the Maven dependency you want. Try searching for "org.scalatest:scalatest" to get the list of scalatest libraries.

To install the latest version of ScalaTest and its dependencies in IntelliJ IDEA 2016.3.2 , you need:

  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

    • 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 .

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

  3. Go to Project Settings | Modules Project Settings | Modules section and click on Dependencies tab. Then click +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 :
    下载对话框

  5. Repeat steps 3 and 4 until all dependencies are installed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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