Instance variables are null when extending a mojo -------------------------------------------------
Key: MNG-2797 URL: http://jira.codehaus.org/browse/MNG-2797 Project: Maven 2 Issue Type: Bug Components: Plugin API Affects Versions: 2.0.4 Environment: Tested on Fedora Core 6. Reporter: Petar Tahchiev Hi gyus, first of all I want to be execused if this is not the right place to post this. Now on the problem: I am trying to make my own mojo and for the purpose I extend an exisitng mojo (for example SurefirePlugin). So my mojo is something like this: public class MyTestMojo extends AbstractMojo { /** * This is the mojo's "main" method. * * @throws MojoExecutionException in case of error * @throws MojoFailureException in case of error */ public void execute() throws MojoExecutionException, MojoFailureException { super.execute(); } } After building my mojo as maven plugin and trying to run it, I get the following stack-trace. [INFO] ------------------------------------------------------------------------ [ERROR] FATAL ERROR [INFO] ------------------------------------------------------------------------ [INFO] null [INFO] ------------------------------------------------------------------------ [INFO] Trace java.lang.NullPointerException at org.apache.maven.plugin.surefire.SurefirePlugin.execute(SurefirePlugin.java:355) at org.apache.cactus.integration.m2.CactusTestMojo.execute(CactusTestMojo.java:53) at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:412) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:534) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:488) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:458) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:306) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:273) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:140) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115) at org.apache.maven.cli.MavenCli.main(MavenCli.java:256) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315) at org.codehaus.classworlds.Launcher.launch(Launcher.java:255) at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430) at org.codehaus.classworlds.Launcher.main(Launcher.java:375) And I see on the line 355 of the maven-surefire-plugin (ver.2.2) it stays: else if ( !testClassesDirectory.exists() ) and after debugging it, I see that testClassesDirectory is always null !!! It is really surpising to me, as testClassesDirectory is initialized with the following lines: /** * The directory containing generated test classes of the project being tested. * * @parameter expression="${project.build.testOutputDirectory}" * @required */ private File testClassesDirectory; OK, I want to hear what do you think? -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira