You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Ralph Pöllath <li...@poellath.org> on 2005/08/08 19:18:26 UTC

[m2] NPE when executing surefire:test

Hi,

I always get a NPE when executing surefire:test.

Here's what I'm doing (see below for details):
$ m2 -DgroupId=myCompany -DartifactId=myApp -Dversion=0.1  
archetype:create
$ cd myApp
$ m2 compiler:compile
$ m2 compiler:testCompile
$ m2 surefire:test

[INFO] Diagnosis: Error configuring plugin for execution of  
'surefire:test'.
Caused by: java.lang.NullPointerException
         at  
org.apache.maven.project.MavenProject.getTestClasspathElements 
(MavenProject.java:360)

Any help would be appreciated.

Thanks,
-Ralph.

---

/tmp % m2 -DgroupId=myCompany -DartifactId=myApp -Dversion=0.1  
archetype:create
[INFO]  
------------------------------------------------------------------------ 
----
[INFO] Building Maven Default Project
[INFO]  
------------------------------------------------------------------------ 
----
[INFO] maven-archetype-plugin: resolved to version 1.0-alpha-1 from  
local repository
[INFO] Setting property: classpath.resource.loader.class =>  
'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
[INFO] Setting property: resource.loader => 'classpath'.
[INFO] **************************************************************
[INFO] Starting Jakarta Velocity v1.4
[INFO] RuntimeInstance initializing.
[INFO] Default Properties File: org/apache/velocity/runtime/defaults/ 
velocity.properties
[INFO] Default ResourceManager initializing. (class  
org.apache.velocity.runtime.resource.ResourceManagerImpl)
[INFO] Resource Loader Instantiated:  
org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader
[INFO] ClasspathResourceLoader : initialization starting.
[INFO] ClasspathResourceLoader : initialization complete.
[INFO] ResourceCache : initialized. (class  
org.apache.velocity.runtime.resource.ResourceCacheImpl)
[INFO] Default ResourceManager initialization complete.
[INFO] Loaded System Directive:  
org.apache.velocity.runtime.directive.Literal
[INFO] Loaded System Directive:  
org.apache.velocity.runtime.directive.Macro
[INFO] Loaded System Directive:  
org.apache.velocity.runtime.directive.Parse
[INFO] Loaded System Directive:  
org.apache.velocity.runtime.directive.Include
[INFO] Loaded System Directive:  
org.apache.velocity.runtime.directive.Foreach
[INFO] Created: 20 parsers.
[INFO] Velocimacro : initialization starting.
[INFO] Velocimacro : adding VMs from VM library template :  
VM_global_library.vm
[ERROR] ResourceManager : unable to find resource  
'VM_global_library.vm' in any resource loader.
[INFO] Velocimacro : error using  VM library template  
VM_global_library.vm :  
org.apache.velocity.exception.ResourceNotFoundException: Unable to  
find resource 'VM_global_library.vm'
[INFO] Velocimacro :  VM library template macro registration complete.
[INFO] Velocimacro : allowInline = true : VMs can be defined inline  
in templates
[INFO] Velocimacro : allowInlineToOverride = false : VMs defined  
inline may NOT replace previous VM definitions
[INFO] Velocimacro : allowInlineLocal = false : VMs defined inline  
will be  global in scope if allowed.
[INFO] Velocimacro : messages on  : VM system will output logging  
messages
[INFO] Velocimacro : autoload off  : VM system will not automatically  
reload global library macros
[INFO] Velocimacro : initialization complete.
[INFO] Velocity successfully started.
[INFO] [archetype:create]
[INFO] maven-archetype-quickstart: resolved to version 1.0-alpha-2  
from local repository
[INFO]  
------------------------------------------------------------------------ 
----
[INFO] Using following parameters for creating Archetype: maven- 
archetype-quickstart:RELEASE
[INFO]  
------------------------------------------------------------------------ 
----
[INFO] Parameter: groupId, Value: myCompany
[INFO] Parameter: outputDirectory, Value: /private/tmp/myApp
[INFO] Parameter: packageName, Value: com.mycompany.app
[INFO] Parameter: package, Value: com.mycompany.app
[INFO] Parameter: version, Value: 0.1
[INFO] Parameter: artifactId, Value: myApp
[INFO] ResourceManager : found archetype-resources/pom.xml with  
loader org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader
[INFO] ResourceManager : found archetype-resources/src/main/java/ 
App.java with loader  
org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader
[INFO] ResourceManager : found archetype-resources/src/test/java/ 
AppTest.java with loader  
org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader
[INFO] Archetype created in dir: /private/tmp/myApp
[INFO]  
------------------------------------------------------------------------ 
----
[INFO] BUILD SUCCESSFUL
[INFO]  
------------------------------------------------------------------------ 
----
[INFO] Total time: 3 seconds
[INFO] Finished at: Mon Aug 08 19:13:09 CEST 2005
[INFO] Final Memory: 3M/6M
[INFO]  
------------------------------------------------------------------------ 
----
/tmp % cd myApp
/tmp/myApp % m2 compiler:compile
[INFO]  
------------------------------------------------------------------------ 
----
[INFO] Building Maven Quick Start Archetype
[INFO]  
------------------------------------------------------------------------ 
----
[INFO] maven-compiler-plugin: resolved to version 2.0-alpha-3 from  
local repository
[INFO] [compiler:compile]
Compiling 1 source file to /private/tmp/myApp/target/classes
[INFO]  
------------------------------------------------------------------------ 
----
[INFO] BUILD SUCCESSFUL
[INFO]  
------------------------------------------------------------------------ 
----
[INFO] Total time: 1 second
[INFO] Finished at: Mon Aug 08 19:13:24 CEST 2005
[INFO] Final Memory: 1M/7M
[INFO]  
------------------------------------------------------------------------ 
----
/tmp/myApp % m2 compiler:testCompile
[INFO]  
------------------------------------------------------------------------ 
----
[INFO] Building Maven Quick Start Archetype
[INFO]  
------------------------------------------------------------------------ 
----
[INFO] maven-compiler-plugin: resolved to version 2.0-alpha-3 from  
local repository
[INFO] [compiler:testCompile]
Compiling 1 source file to /private/tmp/myApp/target/test-classes
[INFO]  
------------------------------------------------------------------------ 
----
[INFO] BUILD SUCCESSFUL
[INFO]  
------------------------------------------------------------------------ 
----
[INFO] Total time: 1 second
[INFO] Finished at: Mon Aug 08 19:13:31 CEST 2005
[INFO] Final Memory: 1M/7M
[INFO]  
------------------------------------------------------------------------ 
----
/tmp/myApp % m2 surefire:test
[INFO]  
------------------------------------------------------------------------ 
----
[INFO] Building Maven Quick Start Archetype
[INFO]  
------------------------------------------------------------------------ 
----
[INFO] maven-surefire-plugin: resolved to version 2.0-alpha-3 from  
local repository
[INFO]  
------------------------------------------------------------------------ 
----
[ERROR] BUILD ERROR
[INFO]  
------------------------------------------------------------------------ 
----
[INFO] Diagnosis: Error configuring plugin for execution of  
'surefire:test'.
[INFO]  
------------------------------------------------------------------------ 
----
[ERROR] Cause:
org.apache.maven.plugin.MojoExecutionException: Error configuring  
plugin for execution of 'surefire:test'.
         at org.apache.maven.plugin.DefaultPluginManager.executeMojo 
(DefaultPluginManager.java:378)
         at  
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals 
(DefaultLifecycleExecutor.java:169)
         at  
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoa 
l(DefaultLifecycleExecutor.java:150)
         at  
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal 
(DefaultLifecycleExecutor.java:133)
         at  
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute 
(DefaultLifecycleExecutor.java:103)
         at org.apache.maven.DefaultMaven.processProject 
(DefaultMaven.java:261)
         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:180)
         at org.apache.maven.cli.MavenCli.main(MavenCli.java:269)
         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:324)
         at org.codehaus.classworlds.Launcher.launchEnhanced 
(Launcher.java:303)
         at org.codehaus.classworlds.Launcher.launch(Launcher.java:243)
         at org.codehaus.classworlds.Launcher.mainWithExitCode 
(Launcher.java:416)
         at org.codehaus.classworlds.Launcher.main(Launcher.java:363)
Caused by: org.apache.maven.plugin.PluginConfigurationException: Bad  
expression
         at  
org.apache.maven.plugin.DefaultPluginManager.checkRequiredParameters 
(DefaultPluginManager.java:718)
         at  
org.apache.maven.plugin.DefaultPluginManager.getConfiguredMojo 
(DefaultPluginManager.java:527)
         at org.apache.maven.plugin.DefaultPluginManager.executeMojo 
(DefaultPluginManager.java:373)
         ... 15 more
Caused by:  
org.codehaus.plexus.component.configurator.expression.ExpressionEvaluati 
onException: Error evaluating plugin parameter expression:  
project.testClasspathElements
         at  
org.apache.maven.plugin.PluginParameterExpressionEvaluator.evaluate 
(PluginParameterExpressionEvaluator.java:125)
         at  
org.apache.maven.plugin.DefaultPluginManager.checkRequiredParameters 
(DefaultPluginManager.java:694)
         ... 17 more
Caused by: java.lang.reflect.InvocationTargetException
         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:324)
         at  
org.codehaus.plexus.util.introspection.ReflectionValueExtractor.evaluate 
(ReflectionValueExtractor.java:82)
         at  
org.apache.maven.plugin.PluginParameterExpressionEvaluator.evaluate 
(PluginParameterExpressionEvaluator.java:119)
         ... 18 more
Caused by: java.lang.NullPointerException
         at  
org.apache.maven.project.MavenProject.getTestClasspathElements 
(MavenProject.java:360)
         ... 24 more
[INFO]  
------------------------------------------------------------------------ 
----
[INFO] Total time: 2 seconds
[INFO] Finished at: Mon Aug 08 19:13:38 CEST 2005
[INFO] Final Memory: 1M/3M
[INFO]  
------------------------------------------------------------------------ 
----
/tmp/myApp %

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: [m2] NPE when executing surefire:test

Posted by Ralph Pöllath <li...@poellath.org>.
On 08.08.2005, at 19:25, Kenney Westerhof wrote:
> You should call 'm2 test', not each individual plugin.

Thanks, 'm2 test' works as expected.

> However, seems you discovered a bug! We'll look into it.

Glad I could help :)

Cheers,
-Ralph.

> On Mon, 8 Aug 2005, [ISO-8859-1] Ralph Pöllath wrote:
>> I always get a NPE when executing surefire:test.
>>
>> Here's what I'm doing (see below for details):
>> $ m2 -DgroupId=myCompany -DartifactId=myApp -Dversion=0.1
>> archetype:create
>> $ cd myApp
>> $ m2 compiler:compile
>> $ m2 compiler:testCompile
>> $ m2 surefire:test
>>
>> [INFO] Diagnosis: Error configuring plugin for execution of
>> 'surefire:test'.
>> Caused by: java.lang.NullPointerException
>>          at
>> org.apache.maven.project.MavenProject.getTestClasspathElements
>> (MavenProject.java:360)
>>
>> Any help would be appreciated.
>>
>> Thanks,
>> -Ralph.
>>
>> ---
>>
>> /tmp % m2 -DgroupId=myCompany -DartifactId=myApp -Dversion=0.1
>> archetype:create
>> [INFO]
>> --------------------------------------------------------------------- 
>> ---
>> ----
>> [INFO] Building Maven Default Project
>> [INFO]
>> --------------------------------------------------------------------- 
>> ---
>> ----
>> [INFO] maven-archetype-plugin: resolved to version 1.0-alpha-1 from
>> local repository
>> [INFO] Setting property: classpath.resource.loader.class =>
>> 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
>> [INFO] Setting property: resource.loader => 'classpath'.
>> [INFO] **************************************************************
>> [INFO] Starting Jakarta Velocity v1.4
>> [INFO] RuntimeInstance initializing.
>> [INFO] Default Properties File: org/apache/velocity/runtime/defaults/
>> velocity.properties
>> [INFO] Default ResourceManager initializing. (class
>> org.apache.velocity.runtime.resource.ResourceManagerImpl)
>> [INFO] Resource Loader Instantiated:
>> org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader
>> [INFO] ClasspathResourceLoader : initialization starting.
>> [INFO] ClasspathResourceLoader : initialization complete.
>> [INFO] ResourceCache : initialized. (class
>> org.apache.velocity.runtime.resource.ResourceCacheImpl)
>> [INFO] Default ResourceManager initialization complete.
>> [INFO] Loaded System Directive:
>> org.apache.velocity.runtime.directive.Literal
>> [INFO] Loaded System Directive:
>> org.apache.velocity.runtime.directive.Macro
>> [INFO] Loaded System Directive:
>> org.apache.velocity.runtime.directive.Parse
>> [INFO] Loaded System Directive:
>> org.apache.velocity.runtime.directive.Include
>> [INFO] Loaded System Directive:
>> org.apache.velocity.runtime.directive.Foreach
>> [INFO] Created: 20 parsers.
>> [INFO] Velocimacro : initialization starting.
>> [INFO] Velocimacro : adding VMs from VM library template :
>> VM_global_library.vm
>> [ERROR] ResourceManager : unable to find resource
>> 'VM_global_library.vm' in any resource loader.
>> [INFO] Velocimacro : error using  VM library template
>> VM_global_library.vm :
>> org.apache.velocity.exception.ResourceNotFoundException: Unable to
>> find resource 'VM_global_library.vm'
>> [INFO] Velocimacro :  VM library template macro registration  
>> complete.
>> [INFO] Velocimacro : allowInline = true : VMs can be defined inline
>> in templates
>> [INFO] Velocimacro : allowInlineToOverride = false : VMs defined
>> inline may NOT replace previous VM definitions
>> [INFO] Velocimacro : allowInlineLocal = false : VMs defined inline
>> will be  global in scope if allowed.
>> [INFO] Velocimacro : messages on  : VM system will output logging
>> messages
>> [INFO] Velocimacro : autoload off  : VM system will not automatically
>> reload global library macros
>> [INFO] Velocimacro : initialization complete.
>> [INFO] Velocity successfully started.
>> [INFO] [archetype:create]
>> [INFO] maven-archetype-quickstart: resolved to version 1.0-alpha-2
>> from local repository
>> [INFO]
>> --------------------------------------------------------------------- 
>> ---
>> ----
>> [INFO] Using following parameters for creating Archetype: maven-
>> archetype-quickstart:RELEASE
>> [INFO]
>> --------------------------------------------------------------------- 
>> ---
>> ----
>> [INFO] Parameter: groupId, Value: myCompany
>> [INFO] Parameter: outputDirectory, Value: /private/tmp/myApp
>> [INFO] Parameter: packageName, Value: com.mycompany.app
>> [INFO] Parameter: package, Value: com.mycompany.app
>> [INFO] Parameter: version, Value: 0.1
>> [INFO] Parameter: artifactId, Value: myApp
>> [INFO] ResourceManager : found archetype-resources/pom.xml with
>> loader org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader
>> [INFO] ResourceManager : found archetype-resources/src/main/java/
>> App.java with loader
>> org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader
>> [INFO] ResourceManager : found archetype-resources/src/test/java/
>> AppTest.java with loader
>> org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader
>> [INFO] Archetype created in dir: /private/tmp/myApp
>> [INFO]
>> --------------------------------------------------------------------- 
>> ---
>> ----
>> [INFO] BUILD SUCCESSFUL
>> [INFO]
>> --------------------------------------------------------------------- 
>> ---
>> ----
>> [INFO] Total time: 3 seconds
>> [INFO] Finished at: Mon Aug 08 19:13:09 CEST 2005
>> [INFO] Final Memory: 3M/6M
>> [INFO]
>> --------------------------------------------------------------------- 
>> ---
>> ----
>> /tmp % cd myApp
>> /tmp/myApp % m2 compiler:compile
>> [INFO]
>> --------------------------------------------------------------------- 
>> ---
>> ----
>> [INFO] Building Maven Quick Start Archetype
>> [INFO]
>> --------------------------------------------------------------------- 
>> ---
>> ----
>> [INFO] maven-compiler-plugin: resolved to version 2.0-alpha-3 from
>> local repository
>> [INFO] [compiler:compile]
>> Compiling 1 source file to /private/tmp/myApp/target/classes
>> [INFO]
>> --------------------------------------------------------------------- 
>> ---
>> ----
>> [INFO] BUILD SUCCESSFUL
>> [INFO]
>> --------------------------------------------------------------------- 
>> ---
>> ----
>> [INFO] Total time: 1 second
>> [INFO] Finished at: Mon Aug 08 19:13:24 CEST 2005
>> [INFO] Final Memory: 1M/7M
>> [INFO]
>> --------------------------------------------------------------------- 
>> ---
>> ----
>> /tmp/myApp % m2 compiler:testCompile
>> [INFO]
>> --------------------------------------------------------------------- 
>> ---
>> ----
>> [INFO] Building Maven Quick Start Archetype
>> [INFO]
>> --------------------------------------------------------------------- 
>> ---
>> ----
>> [INFO] maven-compiler-plugin: resolved to version 2.0-alpha-3 from
>> local repository
>> [INFO] [compiler:testCompile]
>> Compiling 1 source file to /private/tmp/myApp/target/test-classes
>> [INFO]
>> --------------------------------------------------------------------- 
>> ---
>> ----
>> [INFO] BUILD SUCCESSFUL
>> [INFO]
>> --------------------------------------------------------------------- 
>> ---
>> ----
>> [INFO] Total time: 1 second
>> [INFO] Finished at: Mon Aug 08 19:13:31 CEST 2005
>> [INFO] Final Memory: 1M/7M
>> [INFO]
>> --------------------------------------------------------------------- 
>> ---
>> ----
>> /tmp/myApp % m2 surefire:test
>> [INFO]
>> --------------------------------------------------------------------- 
>> ---
>> ----
>> [INFO] Building Maven Quick Start Archetype
>> [INFO]
>> --------------------------------------------------------------------- 
>> ---
>> ----
>> [INFO] maven-surefire-plugin: resolved to version 2.0-alpha-3 from
>> local repository
>> [INFO]
>> --------------------------------------------------------------------- 
>> ---
>> ----
>> [ERROR] BUILD ERROR
>> [INFO]
>> --------------------------------------------------------------------- 
>> ---
>> ----
>> [INFO] Diagnosis: Error configuring plugin for execution of
>> 'surefire:test'.
>> [INFO]
>> --------------------------------------------------------------------- 
>> ---
>> ----
>> [ERROR] Cause:
>> org.apache.maven.plugin.MojoExecutionException: Error configuring
>> plugin for execution of 'surefire:test'.
>>          at org.apache.maven.plugin.DefaultPluginManager.executeMojo
>> (DefaultPluginManager.java:378)
>>          at
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals
>> (DefaultLifecycleExecutor.java:169)
>>          at
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandalone 
>> Goa
>> l(DefaultLifecycleExecutor.java:150)
>>          at
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal
>> (DefaultLifecycleExecutor.java:133)
>>          at
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute
>> (DefaultLifecycleExecutor.java:103)
>>          at org.apache.maven.DefaultMaven.processProject
>> (DefaultMaven.java:261)
>>          at org.apache.maven.DefaultMaven.execute 
>> (DefaultMaven.java:180)
>>          at org.apache.maven.cli.MavenCli.main(MavenCli.java:269)
>>          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:324)
>>          at org.codehaus.classworlds.Launcher.launchEnhanced
>> (Launcher.java:303)
>>          at org.codehaus.classworlds.Launcher.launch(Launcher.java: 
>> 243)
>>          at org.codehaus.classworlds.Launcher.mainWithExitCode
>> (Launcher.java:416)
>>          at org.codehaus.classworlds.Launcher.main(Launcher.java:363)
>> Caused by: org.apache.maven.plugin.PluginConfigurationException: Bad
>> expression
>>          at
>> org.apache.maven.plugin.DefaultPluginManager.checkRequiredParameters
>> (DefaultPluginManager.java:718)
>>          at
>> org.apache.maven.plugin.DefaultPluginManager.getConfiguredMojo
>> (DefaultPluginManager.java:527)
>>          at org.apache.maven.plugin.DefaultPluginManager.executeMojo
>> (DefaultPluginManager.java:373)
>>          ... 15 more
>> Caused by:
>> org.codehaus.plexus.component.configurator.expression.ExpressionEvalu 
>> ati
>> onException: Error evaluating plugin parameter expression:
>> project.testClasspathElements
>>          at
>> org.apache.maven.plugin.PluginParameterExpressionEvaluator.evaluate
>> (PluginParameterExpressionEvaluator.java:125)
>>          at
>> org.apache.maven.plugin.DefaultPluginManager.checkRequiredParameters
>> (DefaultPluginManager.java:694)
>>          ... 17 more
>> Caused by: java.lang.reflect.InvocationTargetException
>>          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:324)
>>          at
>> org.codehaus.plexus.util.introspection.ReflectionValueExtractor.evalu 
>> ate
>> (ReflectionValueExtractor.java:82)
>>          at
>> org.apache.maven.plugin.PluginParameterExpressionEvaluator.evaluate
>> (PluginParameterExpressionEvaluator.java:119)
>>          ... 18 more
>> Caused by: java.lang.NullPointerException
>>          at
>> org.apache.maven.project.MavenProject.getTestClasspathElements
>> (MavenProject.java:360)
>>          ... 24 more
>> [INFO]
>> --------------------------------------------------------------------- 
>> ---
>> ----
>> [INFO] Total time: 2 seconds
>> [INFO] Finished at: Mon Aug 08 19:13:38 CEST 2005
>> [INFO] Final Memory: 1M/3M
>> [INFO]
>> --------------------------------------------------------------------- 
>> ---


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: [m2] NPE when executing surefire:test

Posted by Kenney Westerhof <ke...@apache.org>.
On Mon, 8 Aug 2005, [ISO-8859-1] Ralph P�llath wrote:

Hi,

You should call 'm2 test', not each individual plugin.

However, seems you discovered a bug! We'll look into it.

-- Kenney

> Hi,
>
> I always get a NPE when executing surefire:test.
>
> Here's what I'm doing (see below for details):
> $ m2 -DgroupId=myCompany -DartifactId=myApp -Dversion=0.1
> archetype:create
> $ cd myApp
> $ m2 compiler:compile
> $ m2 compiler:testCompile
> $ m2 surefire:test
>
> [INFO] Diagnosis: Error configuring plugin for execution of
> 'surefire:test'.
> Caused by: java.lang.NullPointerException
>          at
> org.apache.maven.project.MavenProject.getTestClasspathElements
> (MavenProject.java:360)
>
> Any help would be appreciated.
>
> Thanks,
> -Ralph.
>
> ---
>
> /tmp % m2 -DgroupId=myCompany -DartifactId=myApp -Dversion=0.1
> archetype:create
> [INFO]
> ------------------------------------------------------------------------
> ----
> [INFO] Building Maven Default Project
> [INFO]
> ------------------------------------------------------------------------
> ----
> [INFO] maven-archetype-plugin: resolved to version 1.0-alpha-1 from
> local repository
> [INFO] Setting property: classpath.resource.loader.class =>
> 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
> [INFO] Setting property: resource.loader => 'classpath'.
> [INFO] **************************************************************
> [INFO] Starting Jakarta Velocity v1.4
> [INFO] RuntimeInstance initializing.
> [INFO] Default Properties File: org/apache/velocity/runtime/defaults/
> velocity.properties
> [INFO] Default ResourceManager initializing. (class
> org.apache.velocity.runtime.resource.ResourceManagerImpl)
> [INFO] Resource Loader Instantiated:
> org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader
> [INFO] ClasspathResourceLoader : initialization starting.
> [INFO] ClasspathResourceLoader : initialization complete.
> [INFO] ResourceCache : initialized. (class
> org.apache.velocity.runtime.resource.ResourceCacheImpl)
> [INFO] Default ResourceManager initialization complete.
> [INFO] Loaded System Directive:
> org.apache.velocity.runtime.directive.Literal
> [INFO] Loaded System Directive:
> org.apache.velocity.runtime.directive.Macro
> [INFO] Loaded System Directive:
> org.apache.velocity.runtime.directive.Parse
> [INFO] Loaded System Directive:
> org.apache.velocity.runtime.directive.Include
> [INFO] Loaded System Directive:
> org.apache.velocity.runtime.directive.Foreach
> [INFO] Created: 20 parsers.
> [INFO] Velocimacro : initialization starting.
> [INFO] Velocimacro : adding VMs from VM library template :
> VM_global_library.vm
> [ERROR] ResourceManager : unable to find resource
> 'VM_global_library.vm' in any resource loader.
> [INFO] Velocimacro : error using  VM library template
> VM_global_library.vm :
> org.apache.velocity.exception.ResourceNotFoundException: Unable to
> find resource 'VM_global_library.vm'
> [INFO] Velocimacro :  VM library template macro registration complete.
> [INFO] Velocimacro : allowInline = true : VMs can be defined inline
> in templates
> [INFO] Velocimacro : allowInlineToOverride = false : VMs defined
> inline may NOT replace previous VM definitions
> [INFO] Velocimacro : allowInlineLocal = false : VMs defined inline
> will be  global in scope if allowed.
> [INFO] Velocimacro : messages on  : VM system will output logging
> messages
> [INFO] Velocimacro : autoload off  : VM system will not automatically
> reload global library macros
> [INFO] Velocimacro : initialization complete.
> [INFO] Velocity successfully started.
> [INFO] [archetype:create]
> [INFO] maven-archetype-quickstart: resolved to version 1.0-alpha-2
> from local repository
> [INFO]
> ------------------------------------------------------------------------
> ----
> [INFO] Using following parameters for creating Archetype: maven-
> archetype-quickstart:RELEASE
> [INFO]
> ------------------------------------------------------------------------
> ----
> [INFO] Parameter: groupId, Value: myCompany
> [INFO] Parameter: outputDirectory, Value: /private/tmp/myApp
> [INFO] Parameter: packageName, Value: com.mycompany.app
> [INFO] Parameter: package, Value: com.mycompany.app
> [INFO] Parameter: version, Value: 0.1
> [INFO] Parameter: artifactId, Value: myApp
> [INFO] ResourceManager : found archetype-resources/pom.xml with
> loader org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader
> [INFO] ResourceManager : found archetype-resources/src/main/java/
> App.java with loader
> org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader
> [INFO] ResourceManager : found archetype-resources/src/test/java/
> AppTest.java with loader
> org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader
> [INFO] Archetype created in dir: /private/tmp/myApp
> [INFO]
> ------------------------------------------------------------------------
> ----
> [INFO] BUILD SUCCESSFUL
> [INFO]
> ------------------------------------------------------------------------
> ----
> [INFO] Total time: 3 seconds
> [INFO] Finished at: Mon Aug 08 19:13:09 CEST 2005
> [INFO] Final Memory: 3M/6M
> [INFO]
> ------------------------------------------------------------------------
> ----
> /tmp % cd myApp
> /tmp/myApp % m2 compiler:compile
> [INFO]
> ------------------------------------------------------------------------
> ----
> [INFO] Building Maven Quick Start Archetype
> [INFO]
> ------------------------------------------------------------------------
> ----
> [INFO] maven-compiler-plugin: resolved to version 2.0-alpha-3 from
> local repository
> [INFO] [compiler:compile]
> Compiling 1 source file to /private/tmp/myApp/target/classes
> [INFO]
> ------------------------------------------------------------------------
> ----
> [INFO] BUILD SUCCESSFUL
> [INFO]
> ------------------------------------------------------------------------
> ----
> [INFO] Total time: 1 second
> [INFO] Finished at: Mon Aug 08 19:13:24 CEST 2005
> [INFO] Final Memory: 1M/7M
> [INFO]
> ------------------------------------------------------------------------
> ----
> /tmp/myApp % m2 compiler:testCompile
> [INFO]
> ------------------------------------------------------------------------
> ----
> [INFO] Building Maven Quick Start Archetype
> [INFO]
> ------------------------------------------------------------------------
> ----
> [INFO] maven-compiler-plugin: resolved to version 2.0-alpha-3 from
> local repository
> [INFO] [compiler:testCompile]
> Compiling 1 source file to /private/tmp/myApp/target/test-classes
> [INFO]
> ------------------------------------------------------------------------
> ----
> [INFO] BUILD SUCCESSFUL
> [INFO]
> ------------------------------------------------------------------------
> ----
> [INFO] Total time: 1 second
> [INFO] Finished at: Mon Aug 08 19:13:31 CEST 2005
> [INFO] Final Memory: 1M/7M
> [INFO]
> ------------------------------------------------------------------------
> ----
> /tmp/myApp % m2 surefire:test
> [INFO]
> ------------------------------------------------------------------------
> ----
> [INFO] Building Maven Quick Start Archetype
> [INFO]
> ------------------------------------------------------------------------
> ----
> [INFO] maven-surefire-plugin: resolved to version 2.0-alpha-3 from
> local repository
> [INFO]
> ------------------------------------------------------------------------
> ----
> [ERROR] BUILD ERROR
> [INFO]
> ------------------------------------------------------------------------
> ----
> [INFO] Diagnosis: Error configuring plugin for execution of
> 'surefire:test'.
> [INFO]
> ------------------------------------------------------------------------
> ----
> [ERROR] Cause:
> org.apache.maven.plugin.MojoExecutionException: Error configuring
> plugin for execution of 'surefire:test'.
>          at org.apache.maven.plugin.DefaultPluginManager.executeMojo
> (DefaultPluginManager.java:378)
>          at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals
> (DefaultLifecycleExecutor.java:169)
>          at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoa
> l(DefaultLifecycleExecutor.java:150)
>          at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal
> (DefaultLifecycleExecutor.java:133)
>          at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute
> (DefaultLifecycleExecutor.java:103)
>          at org.apache.maven.DefaultMaven.processProject
> (DefaultMaven.java:261)
>          at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:180)
>          at org.apache.maven.cli.MavenCli.main(MavenCli.java:269)
>          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:324)
>          at org.codehaus.classworlds.Launcher.launchEnhanced
> (Launcher.java:303)
>          at org.codehaus.classworlds.Launcher.launch(Launcher.java:243)
>          at org.codehaus.classworlds.Launcher.mainWithExitCode
> (Launcher.java:416)
>          at org.codehaus.classworlds.Launcher.main(Launcher.java:363)
> Caused by: org.apache.maven.plugin.PluginConfigurationException: Bad
> expression
>          at
> org.apache.maven.plugin.DefaultPluginManager.checkRequiredParameters
> (DefaultPluginManager.java:718)
>          at
> org.apache.maven.plugin.DefaultPluginManager.getConfiguredMojo
> (DefaultPluginManager.java:527)
>          at org.apache.maven.plugin.DefaultPluginManager.executeMojo
> (DefaultPluginManager.java:373)
>          ... 15 more
> Caused by:
> org.codehaus.plexus.component.configurator.expression.ExpressionEvaluati
> onException: Error evaluating plugin parameter expression:
> project.testClasspathElements
>          at
> org.apache.maven.plugin.PluginParameterExpressionEvaluator.evaluate
> (PluginParameterExpressionEvaluator.java:125)
>          at
> org.apache.maven.plugin.DefaultPluginManager.checkRequiredParameters
> (DefaultPluginManager.java:694)
>          ... 17 more
> Caused by: java.lang.reflect.InvocationTargetException
>          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:324)
>          at
> org.codehaus.plexus.util.introspection.ReflectionValueExtractor.evaluate
> (ReflectionValueExtractor.java:82)
>          at
> org.apache.maven.plugin.PluginParameterExpressionEvaluator.evaluate
> (PluginParameterExpressionEvaluator.java:119)
>          ... 18 more
> Caused by: java.lang.NullPointerException
>          at
> org.apache.maven.project.MavenProject.getTestClasspathElements
> (MavenProject.java:360)
>          ... 24 more
> [INFO]
> ------------------------------------------------------------------------
> ----
> [INFO] Total time: 2 seconds
> [INFO] Finished at: Mon Aug 08 19:13:38 CEST 2005
> [INFO] Final Memory: 1M/3M
> [INFO]
> ------------------------------------------------------------------------
> ----
> /tmp/myApp %
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>

--
Kenney Westerhof
http://www.neonics.com
GPG public key: http://www.gods.nl/~forge/kenneyw.key

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org