How do you add Spock to IntelliJ?

11,289

Solution 1

So.... What I needed to do, since I have maven, was add the following dependency and build:

  <dependency>
     <groupId>org.spockframework</groupId>
     <artifactId>spock-maven</artifactId>
     <version>0.7-groovy-2.0</version>
  </dependency>

If you just need it in IntelliJ, add a new library in Project Structure, and search the library.

Solution 2

spock-core only is required. Add this dependency to pom.xml:

<dependency>
    <groupId>org.spockframework</groupId>
    <artifactId>spock-core</artifactId>
    <version>1.0-groovy-2.4</version>
</dependency>
Share:
11,289
orbfish
Author by

orbfish

Updated on June 04, 2022

Comments

  • orbfish
    orbfish about 2 years

    I'm trying to get a simple "Hello World" Spock test set up in IntelliJ - can't seem to get it going. I have done the following:

    • Downloaded and installed the plugin
    • Selected the class name in the editor
    • Navigated "Go-To" to "Test"
    • "Create new test..."
    • Selected Spock radio button

    At this point, I get a "Spock library not found in the module" message below the radio buttons. There is no suggested solution here to install it. Is there some kind of Maven setup I need to do to the module? This was not necessary for Groovy setup, which did not need dependencies in Maven.