uninstantiable expressions fail, even if not required
-----------------------------------------------------

         Key: MNG-2171
         URL: http://jira.codehaus.org/browse/MNG-2171
     Project: Maven 2
        Type: Bug

  Components: Plugins and Lifecycle  
    Versions: 2.0.3    
    Reporter: Brett Porter


I tihnk this is actually in plexus' configurator. Try these:

@parameter expression="${executedProject}"
or
@parameter default-value="${executedProject}"

In a mojo with no @execute tag.

The first gives:
[INFO] 
----------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] 
----------------------------------------------------------------------------
[INFO] Failed to configure plugin parameters for: 
org.codehaus.mojo:cobertura-maven-plugin:2.0-SNAPSHOT

on the command line, specify: '-DexecutedProject=VALUE'

Cause: Class 'org.apache.maven.project.MavenProject' cannot be instantiated
[INFO] 
----------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Error getting reports 
from the plugin 'org.codehaus.mojo:cobertura-maven-plugin'
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.getReports(DefaultLifecycleExecutor.java:694)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.getReports(DefaultLifecycleExecutor.java:637)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:512)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:475)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:454)
        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)
Caused by: org.apache.maven.plugin.PluginConfigurationException: Error 
configuring: org.codehaus.mojo:cobertura-maven-plugin. Reason: Unable to parse 
the created DOM for plugi
n configuration
        at 
org.apache.maven.plugin.DefaultPluginManager.populatePluginFields(DefaultPluginManager.java:1036)
        at 
org.apache.maven.plugin.DefaultPluginManager.getConfiguredMojo(DefaultPluginManager.java:576)
        at 
org.apache.maven.plugin.DefaultPluginManager.getReport(DefaultPluginManager.java:462)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.getReports(DefaultLifecycleExecutor.java:678)
        ... 18 more
Caused by: 
org.codehaus.plexus.component.configurator.ComponentConfigurationException: 
Class 'org.apache.maven.project.MavenProject' cannot be instantiated
        at 
org.codehaus.plexus.component.configurator.converters.AbstractConfigurationConverter.instantiateObject(AbstractConfigurationConverter.java:121)
        at 
org.codehaus.plexus.component.configurator.converters.composite.ObjectWithFieldsConverter.fromConfiguration(ObjectWithFieldsConverter.java:88)
        at 
org.codehaus.plexus.component.configurator.converters.ComponentValueSetter.configure(ComponentValueSetter.java:247)
        at 
org.codehaus.plexus.component.configurator.converters.composite.ObjectWithFieldsConverter.processConfiguration(ObjectWithFieldsConverter.java:137)
        at 
org.codehaus.plexus.component.configurator.BasicComponentConfigurator.configureComponent(BasicComponentConfigurator.java:56)
        at 
org.apache.maven.plugin.DefaultPluginManager.populatePluginFields(DefaultPluginManager.java:1030)
        ... 21 more
Caused by: java.lang.InstantiationException: 
org.apache.maven.project.MavenProject
        at java.lang.Class.newInstance0(Class.java:335)
        at java.lang.Class.newInstance(Class.java:303)
        at 
org.codehaus.plexus.component.configurator.converters.AbstractConfigurationConverter.instantiateObject(AbstractConfigurationConverter.java:111)
        ... 26 more

The second instead evaluates the expression as '' (empty string) and can't put 
the empty string into the maven project. Both should set it to null (ie, skip 
it).

-- 
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

Reply via email to