Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-3920

Problem using velocity component

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.0-M1
    • Fix Version/s: 2.0.11, 2.1.0
    • Component/s: Plugins and Lifecycle
    • Labels:
      None

      Description

      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.

        Attachments

        1. pom.xml
          0.4 kB
          Alfie Kirkpatrick
        2. swfclipse.zip
          15 kB
          Alfie Kirkpatrick

          Issue Links

            Activity

              People

              • Assignee:
                brettporter Brett Porter
                Reporter:
                alfie Alfie Kirkpatrick
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: