These are really two questions:
1. How to get up and running with Spock and Maven 3?
The easiest way is to download the spock-example project from GitHub
(
https://github.com/spockframework/spock-example/downloads). See the
README file. For Maven 3, remove the spock-maven plugin. This plugin
is purely optional and doesn't work with Maven 3. In that case, make
sure to name the spec classes after the Surefire naming conventions
(e.g. *Test if you haven't reconfigured Surefire). Because the spec
classes in the spock-example project don't follow this convention,
this is a common pitfall. The next version of Spock will hopefully
also provide a plugin for Maven 3. This will require a complete
rewrite of the plugin, but I'm already halfway through.
2. How to get up and running with Spock and Eclipse?
Either follow the instructions in the spock-example README (i.e. use
Gradle to auto-generate the Eclipse project), or check out the
information in the Spock Wiki (
http://code.google.com/p/spock/wiki/
GettingStarted#Eclipse). The most common reasons for this not working
are:
* You are using Eclipse <= 3.5 but haven't added the spock-core
sources Jar (see Spock Wiki for more information on this)
* The Groovy Eclipse plugin isn't installed or the installation is
broken
* You are using the spock-core Jar for major Groovy version x (e.g.
1.8) but the Groovy Eclipse plugin is configured to use Groovy major
version y (e.g. 1.7)
* The Eclipse project is missing the Groovy nature (Select project in
Project or Package Explorer -> Context Menu -> Groovy -> Add Groovy
nature). This hint seems to be missing from the Spock Wiki.
* The spec class isn't extending spock.lang.Specification or a
subclass thereof
Make sure to use the latest release version of Spock (spock-core-0.6-
groovy-1.7 or spock-core-0.6-groovy-1.8) and the latest release
version of the Groovy Eclipse plugin. Check the errors tab in Eclipse
and the Eclipse error log. Perform a clean build.
Hope this helps.
Cheers,
Peter
On May 2, 1:24 pm, Emmanuel DEMEY <
demey.emman...@gmail.com> wrote:
> Hi everybody,
>
> I am quit a newbie of Spock, but I tried to run my first Spock test on
> Eclipse, and it does not work.
>
> I installed the Groovy Eclipse plugin, and follow this tutorial :
http://mrhaki.blogspot.fr/2011/01/spocklight-add-spock-support-to-jav...
>
> I did not specify the spock plugin in my pom.xml file, because I use Maven
> 3, and this plugin does not work with this version. But when I run the
> jUnit Test (Alt + shift + x +t), there is a popup displaying "No jUnit Test
> found". What am I doing wrong ?
>
> My Groovy test is part of a Java project. Do I have to convert my Java
> Project into a Groovy project, like explained in the Haki's tutorial ?
>
> Thanks a lot.
>
> Manu
>
> --
> Emmanuel DEMEY
> Ingénieur Etude et Développement
> ATOS Worldline
>
+33 (0)6 47 47 42 02
>
demey.emman...@gmail.com
>
> Twitter : @gillespie59