dcrec1 / rspec-maven-plugin

Fork of http://svn.codehaus.org/mojo/trunk/sandbox/rspec-maven-plugin/
http://www.diegocarrion.com
12 stars 4 forks source link

NPE if no systemproperties set #4

Open reynders opened 12 years ago

reynders commented 12 years ago

First of all, what is the relation of this github repository to

http://mojo.codehaus.org/rspec-maven-plugin/xref/org/codehaus/mojo/rspec ?

The reason I am asking is that the latter one is what I get for a dependency to rspec-maven-plugin when I use the default maven repository, and it has a bug.

The bug appears when I try to use it as described in

http://mojo.codehaus.org/rspec-maven-plugin/

I get a NPE:

[INFO] Running RSpec tests from /home/reynders/project/x/src/test/specs [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)

This is caused by the plugin expecting that there is a systemProperties injected to the mojo and it is not anymore so, probably because of http://maven.apache.org/plugins/maven-surefire-plugin/examples/system-properties.html

A workaround is to add a dummy systemproperties to the mojo:

            <groupId>org.codehaus.mojo</groupId>
            <artifactId>rspec-maven-plugin</artifactId>
            <configuration>
                <!-- jrubyHome points to the JRuby installation you wish to use (usually ${env.JRUBY_HOME}) -->
                <jrubyHome>${env.JRUBY_HOME}</jrubyHome>
                <!-- sourceDirectory references where your RSpec tests reside -->
                <sourceDirectory>${basedir}/src/test/specs</sourceDirectory>
                <!-- outputDirectory specifies where the RSpec report should be placed -->
                <outputDirectory>${basedir}/target</outputDirectory>
                <systemProperties>
                    <fix.abug>true</fix.abug>
                </systemProperties>
            </configuration>

...

Obvious fix is to check for null.

I'm sorry if this git repo has nothing to do with the official version of the rspec-maven-plugin. If so please let me know and I'll try to look where this bug report belongs to

dcrec1 commented 12 years ago

Hey, this is another another project, no problem.