Is there a way to create and jump to Spock unit test for an application written in Java in Idea IDE (it's working fine for a Groovy app)? The project is Maven based if it matters.
Reason: I'd like to use Spock framework to test my Java app.
Figured out by myself the steps to make it work:
Add the following plugins to the POM file:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.18.1</version> <configuration> <includes> <include>**/*Test.java</include> <include>**/*Spec.java</include> </includes> </configuration> </plugin> <plugin> <groupId>org.codehaus.gmavenplus</groupId> <artifactId>gmavenplus-plugin</artifactId> <version>1.5</version> <executions> <execution> <goals> <goal>addTestSources</goal> <goal>testCompile</goal> </goals> </execution> </executions> </plugin>
src/test/groovyas a source directory you could delete all the Idea project files from you hard-drive and import your Maven project again
After that CTRL+SHIFT+T will offer you to create new tests either in
src/test/java (should be chosen for JUnit tests) or in
src/test/groovy (should be chosen for Spock tests).
P.S. command line
mvn clean test also works correctly running both JUnit and Spock.