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!


Great article very important information i found here R46aRLGEzsyDQN
Excellent job once again! Thanks:)
Excellent story it is without doubt. My girlfriend has been searching for this info.
[...] We could integrate it with our CI. [...]
Great info it is actually. My girlfriend has been awaiting for this information.
Really good blog you’ve got here. You’ll discover me browsing your stuff often. Saved as a favorite!
Hello,
I got following error when executing this on win 7.
Is this pluging not supporting win os, or what could be the problem?
Have not tried on linux.
regards, Matti
[INFO] — rspec-maven-plugin:1.0-beta-6:spec (test) @ vse_mppscripts —
[INFO] Running RSpec tests from D:\subversion\vse\vse_mppscripts\test\
[ERROR] error emitting .sh
java.lang.NullPointerException
at org.codehaus.mojo.rspec.ShellScriptFactory.getScript(ShellScriptFactory.java:26)
at org.codehaus.mojo.rspec.AbstractScriptFactory.emit(AbstractScriptFactory.java:44)
at org.codehaus.mojo.rspec.RspecRunnerMojo.execute(RspecRunnerMojo.java:120)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)