You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Alfie Kirkpatrick (JIRA)" <ji...@codehaus.org> on 2008/12/17 09:15:20 UTC
[jira] Created: (MNG-3920) Problem using velocity component
Problem using velocity component
--------------------------------
Key: MNG-3920
URL: http://jira.codehaus.org/browse/MNG-3920
Project: Maven 2
Issue Type: Bug
Components: Plugins and Lifecycle
Affects Versions: 2.1.0-M1
Reporter: Alfie Kirkpatrick
Jason van Zyl asked me to raise this here so he could take a look. Not convinced it is a genuine bug...
I am attempting to write a plugin that uses Velocity to template
some config files. I have been developing the plugin using m2eclipse
embedded maven runtime and it works fine. But it gives a NPE when I run
it in maven standalone, even with the 2.1M1 release.
I have the following in my class:
/**
* @component
*/
protected VelocityComponent velocityComponent;
The line giving the NPE is:
Template template =
velocityComponent.getEngine().getTemplate("/"+templateName+".vm");
When running standalone the velocityComponent is initialised with a
DefaultVelocityComponent but with a null engine, so getTemplate gives
the NPE.
Am struggling to understand if I'm doing this correctly and why it
should work in maven embedder (in m2eclipse) but not standalone?
As an aside, my class implements org.codehaus.plexus.logging.LogEnabled and running with maven embedder, the enableLogging method is called with a PlexusLoggerAdapter, but running standalone this method is not called. Can't help feeling this is related...
I have made use of a class from the eclipse plugin project and have a dependency on other eclipse plugin support classes. This is a mojo to generate project files for FlexBuilder and I ultimately want to contribute this to the flex-mojos project.
Thanks again.
--
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
[jira] Closed: (MNG-3920) Problem using velocity component
Posted by "Brett Porter (JIRA)" <ji...@codehaus.org>.
[ http://jira.codehaus.org/browse/MNG-3920?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Brett Porter closed MNG-3920.
-----------------------------
Assignee: Brett Porter
Resolution: Fixed
fixed
> Problem using velocity component
> --------------------------------
>
> Key: MNG-3920
> URL: http://jira.codehaus.org/browse/MNG-3920
> Project: Maven 2
> Issue Type: Bug
> Components: Plugins and Lifecycle
> Affects Versions: 2.1.0-M1
> Reporter: Alfie Kirkpatrick
> Assignee: Brett Porter
> Fix For: 2.0.11, 2.1.0-M2
>
> Attachments: pom.xml, swfclipse.zip
>
>
> Jason van Zyl asked me to raise this here so he could take a look. Not convinced it is a genuine bug...
> I am attempting to write a plugin that uses Velocity to template
> some config files. I have been developing the plugin using m2eclipse
> embedded maven runtime and it works fine. But it gives a NPE when I run
> it in maven standalone, even with the 2.1M1 release.
> I have the following in my class:
> /**
> * @component
> */
> protected VelocityComponent velocityComponent;
> The line giving the NPE is:
> Template template =
> velocityComponent.getEngine().getTemplate("/"+templateName+".vm");
> When running standalone the velocityComponent is initialised with a
> DefaultVelocityComponent but with a null engine, so getTemplate gives
> the NPE.
> Am struggling to understand if I'm doing this correctly and why it
> should work in maven embedder (in m2eclipse) but not standalone?
> As an aside, my class implements org.codehaus.plexus.logging.LogEnabled and running with maven embedder, the enableLogging method is called with a PlexusLoggerAdapter, but running standalone this method is not called. Can't help feeling this is related...
> I have made use of a class from the eclipse plugin project and have a dependency on other eclipse plugin support classes. This is a mojo to generate project files for FlexBuilder and I ultimately want to contribute this to the flex-mojos project.
> Thanks again.
--
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
[jira] Updated: (MNG-3920) Problem using velocity component
Posted by "Alfie Kirkpatrick (JIRA)" <ji...@codehaus.org>.
[ http://jira.codehaus.org/browse/MNG-3920?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Alfie Kirkpatrick updated MNG-3920:
-----------------------------------
Attachment: pom.xml
swfclipse.zip
Attached are the zipped mojo project and small test pom to reproduce the error. I am mvn installing the plugin then running with:
{code}
mvn com.akirkpatrick:swfclipse:0.0.1-SNAPSHOT:eclipse
{code}
> Problem using velocity component
> --------------------------------
>
> Key: MNG-3920
> URL: http://jira.codehaus.org/browse/MNG-3920
> Project: Maven 2
> Issue Type: Bug
> Components: Plugins and Lifecycle
> Affects Versions: 2.1.0-M1
> Reporter: Alfie Kirkpatrick
> Attachments: pom.xml, swfclipse.zip
>
>
> Jason van Zyl asked me to raise this here so he could take a look. Not convinced it is a genuine bug...
> I am attempting to write a plugin that uses Velocity to template
> some config files. I have been developing the plugin using m2eclipse
> embedded maven runtime and it works fine. But it gives a NPE when I run
> it in maven standalone, even with the 2.1M1 release.
> I have the following in my class:
> /**
> * @component
> */
> protected VelocityComponent velocityComponent;
> The line giving the NPE is:
> Template template =
> velocityComponent.getEngine().getTemplate("/"+templateName+".vm");
> When running standalone the velocityComponent is initialised with a
> DefaultVelocityComponent but with a null engine, so getTemplate gives
> the NPE.
> Am struggling to understand if I'm doing this correctly and why it
> should work in maven embedder (in m2eclipse) but not standalone?
> As an aside, my class implements org.codehaus.plexus.logging.LogEnabled and running with maven embedder, the enableLogging method is called with a PlexusLoggerAdapter, but running standalone this method is not called. Can't help feeling this is related...
> I have made use of a class from the eclipse plugin project and have a dependency on other eclipse plugin support classes. This is a mojo to generate project files for FlexBuilder and I ultimately want to contribute this to the flex-mojos project.
> Thanks again.
--
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
[jira] Commented: (MNG-3920) Problem using velocity component
Posted by "Brett Porter (JIRA)" <ji...@codehaus.org>.
[ http://jira.codehaus.org/browse/MNG-3920?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=162787#action_162787 ]
Brett Porter commented on MNG-3920:
-----------------------------------
You need to add this to your plexus-velocity dependency:
<exclusions>
<exclusion>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-api</artifactId>
</exclusion>
</exclusions>
This is because it clashes with the plexus-container-default in Maven so it uses the wrong Initializable (and LogEnabled) classes.
While not technically a bug in Maven, we could work around this by adding another exclusion. I think we should consider this for 2.0.11.
> Problem using velocity component
> --------------------------------
>
> Key: MNG-3920
> URL: http://jira.codehaus.org/browse/MNG-3920
> Project: Maven 2
> Issue Type: Bug
> Components: Plugins and Lifecycle
> Affects Versions: 2.1.0-M1
> Reporter: Alfie Kirkpatrick
> Fix For: 2.0.11, 2.1.0-M2
>
> Attachments: pom.xml, swfclipse.zip
>
>
> Jason van Zyl asked me to raise this here so he could take a look. Not convinced it is a genuine bug...
> I am attempting to write a plugin that uses Velocity to template
> some config files. I have been developing the plugin using m2eclipse
> embedded maven runtime and it works fine. But it gives a NPE when I run
> it in maven standalone, even with the 2.1M1 release.
> I have the following in my class:
> /**
> * @component
> */
> protected VelocityComponent velocityComponent;
> The line giving the NPE is:
> Template template =
> velocityComponent.getEngine().getTemplate("/"+templateName+".vm");
> When running standalone the velocityComponent is initialised with a
> DefaultVelocityComponent but with a null engine, so getTemplate gives
> the NPE.
> Am struggling to understand if I'm doing this correctly and why it
> should work in maven embedder (in m2eclipse) but not standalone?
> As an aside, my class implements org.codehaus.plexus.logging.LogEnabled and running with maven embedder, the enableLogging method is called with a PlexusLoggerAdapter, but running standalone this method is not called. Can't help feeling this is related...
> I have made use of a class from the eclipse plugin project and have a dependency on other eclipse plugin support classes. This is a mojo to generate project files for FlexBuilder and I ultimately want to contribute this to the flex-mojos project.
> Thanks again.
--
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
[jira] Updated: (MNG-3920) Problem using velocity component
Posted by "Brett Porter (JIRA)" <ji...@codehaus.org>.
[ http://jira.codehaus.org/browse/MNG-3920?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Brett Porter updated MNG-3920:
------------------------------
Fix Version/s: 2.1.0-M2
2.0.11
> Problem using velocity component
> --------------------------------
>
> Key: MNG-3920
> URL: http://jira.codehaus.org/browse/MNG-3920
> Project: Maven 2
> Issue Type: Bug
> Components: Plugins and Lifecycle
> Affects Versions: 2.1.0-M1
> Reporter: Alfie Kirkpatrick
> Fix For: 2.0.11, 2.1.0-M2
>
> Attachments: pom.xml, swfclipse.zip
>
>
> Jason van Zyl asked me to raise this here so he could take a look. Not convinced it is a genuine bug...
> I am attempting to write a plugin that uses Velocity to template
> some config files. I have been developing the plugin using m2eclipse
> embedded maven runtime and it works fine. But it gives a NPE when I run
> it in maven standalone, even with the 2.1M1 release.
> I have the following in my class:
> /**
> * @component
> */
> protected VelocityComponent velocityComponent;
> The line giving the NPE is:
> Template template =
> velocityComponent.getEngine().getTemplate("/"+templateName+".vm");
> When running standalone the velocityComponent is initialised with a
> DefaultVelocityComponent but with a null engine, so getTemplate gives
> the NPE.
> Am struggling to understand if I'm doing this correctly and why it
> should work in maven embedder (in m2eclipse) but not standalone?
> As an aside, my class implements org.codehaus.plexus.logging.LogEnabled and running with maven embedder, the enableLogging method is called with a PlexusLoggerAdapter, but running standalone this method is not called. Can't help feeling this is related...
> I have made use of a class from the eclipse plugin project and have a dependency on other eclipse plugin support classes. This is a mojo to generate project files for FlexBuilder and I ultimately want to contribute this to the flex-mojos project.
> Thanks again.
--
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