Thursday, January 27, 2011

Sample pom.xml For Groovy Project with Spock

Had to setup a new Groovy project using Maven today with Spock as its testing framework. Ran into a few glitch; thought to share it here with a sample pom.xml as a day-log.






4.0.0

sample-group
sample
General Purpose Groovy Project
jar
1.0-SNAPSHOT


0.4-groovy-1.7





org.codehaus.gmaven
gmaven-plugin
1.3



1.7


generateStubs
compile
generateTestStubs
testCompile






org.spockframework
spock-maven
${spock.version}



find-specs









org.codehaus.gmaven.runtime
gmaven-runtime-1.7
1.3



org.spockframework
spock-core
${spock.version}
test






Few things I ran into:

  1. Maven 3 currently does not work with the Spock plugin
  2. Spock plugin version 0.5-groovy-1.7 does not seem to pick up unit spec test correctly, so I had to fall back to 0.4 to make it work
  3. In order to mix both Java and Groovy code you need to enable the stub generate execution phase in GMaven plugin

No comments: