Cool tests in the Java Maven platform now possible with rspec-maven-plugin
I don’t like Maven at all but sometimes depending of the project and the people you need to use this. After playing with RSpec I stop considering any Java language framework acceptable for testing so for this project I’m working on right now I needed to find a solution that could integrate RSpec with Maven.
After googling I found this post from Bob McWhirter where he presented a official rspec-maven-plugin. I tried to use it but it wasn’t working so I forked it, fixed it and changed some things.
The forked version of rspec-maven-plugin is at GitHub and to use it you should:
install the plugin in the local repository (this is necessary only one time):
git clone git://github.com/dcrec1/rspec-maven-plugin.git cd rspec-maven-plugin mvn install
configure your project’s pom.xml adding this:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rspec-maven-plugin</artifactId>
<executions>
<execution>
<id>test</id>
<phase>test</phase>
<goals>
<goal>spec</goal>
</goals>
</execution>
</executions>
</plugin>
set the JRUBY_HOME system variable, for example:
export JRUBY_HOME=/opt/jruby-1.1.6/
The plugin will run in the test phase of the Maven build cycle.
Happy testing!
