In the previous it used the Gmaven plugin compiled groovy/spock, this time using the Gmavenplus plugin, more convenient.
Specific steps
1. Import Spock and Groovy dependencies
<Dependency> <groupId>Org.codehaus.groovy</groupId> <Artifactid>Groovy-all</Artifactid> <version>2.4.1</version> <Scope>Test</Scope> </Dependency> <Dependency> <groupId>Org.spockframework</groupId> <Artifactid>Spock-core</Artifactid> <version>1.0-groovy-2.4</version> <Scope>Test</Scope> </Dependency> <!--http://mvnrepository.com/artifact/org.spockframework/spock-spring - <Dependency> <groupId>Org.spockframework</groupId> <Artifactid>Spock-spring</Artifactid> <version>1.0-groovy-2.4</version> </Dependency>
2. Configure Gmavenplus
<plugin> <groupId>Org.codehaus.gmavenplus</groupId> <Artifactid>Gmavenplus-plugin</Artifactid> <version>1.4</version> <executions> <Execution> <Goals> <goal>Compile</goal> <goal>Testcompile</goal> </Goals> </Execution> </executions> </plugin>
View Code
3. Configure Surefire Plugin
<plugin> <Artifactid>Maven-surefire-plugin</Artifactid> <Configuration> <Testfailureignore>False</Testfailureignore> <includes> <include>**/*spec.java</include> <!--Yes,. java extension - <include>**/*test.java</include> <!--Just in case of having also "normal" JUnit tests - </includes> </Configuration> </plugin>
View Code
Compile Groovy/spock with Gmavenplus