Maven Archetype
  1. Maven Archetype
  2. ARCHETYPE-383

Use velocity expressions in descriptor properties

    Details

    • Type: New Feature New Feature
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: 2.2
    • Component/s: Plugin
    • Labels:
      None
    • Number of attachments :
      1

      Description

      The descriptor can use velocity expressions for value and defaultValue, thus enabling the creation of velocity global properties for an archetype.
      For example :
      <requiredProperty key="className">
      <defaultValue>$

      {rootArtifactId.substring(0,1).toUpperCase()}

      $

      {rootArtifactId.substring(1)}

      </defaultValue>
      </requiredProperty>

        Issue Links

          Activity

          Hide
          Emmanuel Hugonnet added a comment -

          Patch to evaluate properties before the generation of the project

          Show
          Emmanuel Hugonnet added a comment - Patch to evaluate properties before the generation of the project
          Hide
          Emmanuel Hugonnet added a comment -

          This fixes the feature although I don't see the rootArtifactId in the context so I had to use the following expression : $

          {artifactId.substring(0,1).toUpperCase()}

          $

          {artifactId.substring(1)}
          Show
          Emmanuel Hugonnet added a comment - This fixes the feature although I don't see the rootArtifactId in the context so I had to use the following expression : $ {artifactId.substring(0,1).toUpperCase()} $ {artifactId.substring(1)}
          Hide
          Olivier Lamy added a comment -

          maybeVelocityExpression test only contains $, I will add contains on ${

          Show
          Olivier Lamy added a comment - maybeVelocityExpression test only contains $, I will add contains on ${
          Hide
          Olivier Lamy added a comment -

          fixed r1194889
          Thanks!

          Show
          Olivier Lamy added a comment - fixed r1194889 Thanks!
          Hide
          Bue Pierre-Christophe added a comment -

          the bug fiw worked fine for standard properties (artifactId, groupId, ...), but still does not work with user defined properties. For example:

          <requiredProperty key="a">
          <defaultValue>$

          {artifactId}

          .substring(0,1).toUpperCase()</defaultValue>
          </requiredProperty>

          with artifactId=toto will give a=T, but

          <requiredProperty key="b"/>
          <requiredProperty key="a">
          <defaultValue>$

          {b}.substring(0,1).toUpperCase()</defaultValue>
          </requiredProperty>

          with b=toto will give a=${b}

          .substring(0,1).toUpperCase()

          Show
          Bue Pierre-Christophe added a comment - the bug fiw worked fine for standard properties (artifactId, groupId, ...), but still does not work with user defined properties. For example: <requiredProperty key="a"> <defaultValue>$ {artifactId} .substring(0,1).toUpperCase()</defaultValue> </requiredProperty> with artifactId=toto will give a=T, but <requiredProperty key="b"/> <requiredProperty key="a"> <defaultValue>$ {b}.substring(0,1).toUpperCase()</defaultValue> </requiredProperty> with b=toto will give a=${b} .substring(0,1).toUpperCase()
          Hide
          Björn Pollex added a comment -

          This definitely deserves a reopen to make it work for user-defined properties.

          Show
          Björn Pollex added a comment - This definitely deserves a reopen to make it work for user-defined properties.
          Hide
          Olivier Lamy added a comment -

          please reopen an other issue.

          Show
          Olivier Lamy added a comment - please reopen an other issue.
          Hide
          Bue Pierre-Christophe added a comment -

          done with ARCHETYPE-406

          Show
          Bue Pierre-Christophe added a comment - done with ARCHETYPE-406

            People

            • Assignee:
              Olivier Lamy
              Reporter:
              Emmanuel Hugonnet
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: