You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by "Jerome Lacoste (JIRA)" <ji...@codehaus.org> on 2005/10/20 14:27:11 UTC
[jira] Commented: (MNG-1248) configuration inheritence: base class parameters not correctly initialized
[ http://jira.codehaus.org/browse/MNG-1248?page=comments#action_48920 ]
Jerome Lacoste commented on MNG-1248:
-------------------------------------
Just want to add that if I use
<inherited>true</inherited>
in the plugin configuration (which is something I want to avoid), the project field is inialized, but calling methods from the base class return unitialized parameters. E.g. if I call getWebappDirectory(), it will return null.
> configuration inheritence: base class parameters not correctly initialized
> --------------------------------------------------------------------------
>
> Key: MNG-1248
> URL: http://jira.codehaus.org/browse/MNG-1248
> Project: Maven 2
> Type: Bug
> Reporter: Jerome Lacoste
>
>
> Haven't been able to identify the exact reason:
> Here's my use case:
> AbstractWarMojo has a parameter called project accessible by sub-classes using a getProject() method.
> /**
> * The maven project.
> *
> * @parameter expression="${project}"
> * @required
> * @readonly
> */
> private MavenProject project;
> The execution will show that the project parameter has not been initialized correctly.
> I.e. the following code:
> getLog().debug( "project " + this.getProject() ); // from base class
> getLog().debug( "project2 " + this.project2 );
> will display:
> [DEBUG] project null
> [DEBUG] project2 org.apache.maven.project.MavenProject@f79ffcb3
> My work-around was to define a new field in the sub-class called project2.
> I don't see a difference between my mojo and the WarMojo in the way they are configured.
> I've tried to add
> * @requiresDependencyResolution runtime
> * @requiresProject
> * @inheritedByDefault true
> by none of this helped.
> here's the WarMojo META-IN/plugin.xml header
> <goal>war</goal>
> <description>Build a war/webapp.</description>
> <requiresDependencyResolution>runtime</requiresDependencyResolution>
> <requiresDirectInvocation>false</requiresDirectInvocation>
> <requiresProject>true</requiresProject>
> <requiresReports>false</requiresReports>
> <aggregator>false</aggregator>
> <requiresOnline>false</requiresOnline>
> <inheritedByDefault>true</inheritedByDefault>
> <phase>package</phase>
> <implementation>org.apache.maven.plugin.war.WarMojo</implementation>
> <language>java</language>
> <instantiationStrategy>per-lookup</instantiationStrategy>
> <executionStrategy>once-per-session</executionStrategy>
> Here's my plugin header
> <goal>jnlp</goal>
> <description>Packages a jnlp application.</description>
> <requiresDependencyResolution>runtime</requiresDependencyResolution>
> <requiresDirectInvocation>false</requiresDirectInvocation>
> <requiresProject>true</requiresProject>
> <requiresReports>false</requiresReports>
> <aggregator>false</aggregator>
> <requiresOnline>false</requiresOnline>
> <inheritedByDefault>true</inheritedByDefault>
> <phase>compile</phase>
> <implementation>org.codehaus.mojo.webstart.JnlpMojo</implementation>
> <language>java</language>
> <instantiationStrategy>per-lookup</instantiationStrategy>
> <executionStrategy>once-per-session</executionStrategy>
> They are basically identical. The invocation still fails.
--
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
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org