Maven Archetype
  1. Maven Archetype
  2. ARCHETYPE-39

Add tool for working with escaping in Velocity templates

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 1.0-alpha-4
    • Fix Version/s: None
    • Component/s: Plugin
    • Labels:
      None
    • Number of attachments :
      2

      Description

      e.g. I need to put $

      {archifactId}

      (without parameter replacement) into an assembly descriptor. I need to escape the dollar sign.

      This is the Escape Tool of Velocity - http://jakarta.apache.org/velocity/tools/javadoc/org/apache/velocity/tools/generic/EscapeTool.html. The embedded Velocity engine will be configured to use it, or archetype plugin allows further Velocity configuration.

      1. ARCHETYPE-39.patch
        0.6 kB
        Mikko Koponen
      2. ARCHETYPE-39-velocity-escape-tool.patch
        2 kB
        Wendy Smoak

        Issue Links

          Activity

          Hide
          William Ferguson added a comment -

          For those interested in a solution, specify

          #set($dollar = '$')

          at the head of the archetype Velocity template in which you need the unescaped dollar signs.
          Then to get $

          {artifactId} in the output, specify

          ${dollar}{artifactId}
          Show
          William Ferguson added a comment - For those interested in a solution, specify #set($dollar = '$') at the head of the archetype Velocity template in which you need the unescaped dollar signs. Then to get $ {artifactId} in the output, specify ${dollar}{artifactId}
          Hide
          Wendy Smoak added a comment -

          I also edited the earlier comment, which wasn't displaying correctly. I haven't tested it with the latest releases, but in early June, this worked:

          To get $

          {artifactId}

          in the output, use $ \

          { artifactId }

          (with no spaces) in the template.

          Show
          Wendy Smoak added a comment - I also edited the earlier comment, which wasn't displaying correctly. I haven't tested it with the latest releases, but in early June, this worked: To get $ {artifactId} in the output, use $ \ { artifactId } (with no spaces) in the template.
          Hide
          William Ferguson added a comment -

          Thanks Wendy, though I think you meant
          \ $

          {artifactId}

          (without the spaces), ie backslash before the $ and not after.

          Though in the end I found using $

          {dollar}

          to be clearer in the template.

          Show
          William Ferguson added a comment - Thanks Wendy, though I think you meant \ $ {artifactId} (without the spaces), ie backslash before the $ and not after. Though in the end I found using $ {dollar} to be clearer in the template.
          Hide
          Kaizer Sogiawala added a comment -

          It'd be nice to access all Velocity Tools from the archetype (not just the EscapeTools). I have an archetype that need to generate unique serializationID and can't get archetype to replace this one. There is MathTool, but there is no way to inject this into current Context.

          See http://www.nabble.com/How-to-use-velocity-tools-from-a-non-web-application-td6299220.html#a6299317 for a background.

          Show
          Kaizer Sogiawala added a comment - It'd be nice to access all Velocity Tools from the archetype (not just the EscapeTools). I have an archetype that need to generate unique serializationID and can't get archetype to replace this one. There is MathTool, but there is no way to inject this into current Context. See http://www.nabble.com/How-to-use-velocity-tools-from-a-non-web-application-td6299220.html#a6299317 for a background.
          Hide
          Torben Knerr added a comment - - edited

          +1 vote for adding Velocity Tools

          Show
          Torben Knerr added a comment - - edited +1 vote for adding Velocity Tools

            People

            • Assignee:
              Unassigned
              Reporter:
              Willie Vu
            • Votes:
              4 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: