Uploaded image for project: 'Maven Archetype'
  1. Maven Archetype
  2. ARCHETYPE-558

Allow transitive requiredProperty from non default ones

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0.1
    • 3.2.1
    • Generator
    • None

    Description

      Hi,

      I want to create a Maven Archetype with 2 requiredProperty :

       

      <requiredProperty key="apiName" />

      <requiredProperty key="resourceName" />

       

      apiName is used for the artifactId as follow:

      <requiredProperty key="artifactId">
      <defaultValue>${apiName}</defaultValue>
      </requiredProperty>

       

      I want also to define transitive properties from these 2 first properties:

       

      <requiredProperty key="camelCaseAPIName">
      <defaultValue>${artifactId.replaceAll("^a|-a", "A").replaceAll("^b|-b", "B").replaceAll("^c|-c", "C").replaceAll("^d|-d", "D").replaceAll("^e|-e", "E").replaceAll("^f|-f", "F").replaceAll("^g|-g", "G").replaceAll("^h|-h", "H").replaceAll("^i|-i", "I").replaceAll("^j|-j", "J").replaceAll("^k|-k", "K").replaceAll("^l|-l", "L").replaceAll("^m|-m", "M").replaceAll("^n|-n", "N").replaceAll("^o|-o", "O").replaceAll("^p|-p", "P").replaceAll("^q|-q", "Q").replaceAll("^r|-r", "R").replaceAll("^s|-s", "S").replaceAll("^t|-t", "T").replaceAll("^u|-u", "U").replaceAll("^v|-v", "V").replaceAll("^w|-w", "W").replaceAll("^x|-x", "X").replaceAll("^y|-y", "Y").replaceAll("^z|-z", "Z")}</defaultValue>
      </requiredProperty>
      <requiredProperty key="camelCaseResourceName">
      <defaultValue>${resourceName.replaceAll("^a|-a", "A").replaceAll("^b|-b", "B").replaceAll("^c|-c", "C").replaceAll("^d|-d", "D").replaceAll("^e|-e", "E").replaceAll("^f|-f", "F").replaceAll("^g|-g", "G").replaceAll("^h|-h", "H").replaceAll("^i|-i", "I").replaceAll("^j|-j", "J").replaceAll("^k|-k", "K").replaceAll("^l|-l", "L").replaceAll("^m|-m", "M").replaceAll("^n|-n", "N").replaceAll("^o|-o", "O").replaceAll("^p|-p", "P").replaceAll("^q|-q", "Q").replaceAll("^r|-r", "R").replaceAll("^s|-s", "S").replaceAll("^t|-t", "T").replaceAll("^u|-u", "U").replaceAll("^v|-v", "V").replaceAll("^w|-w", "W").replaceAll("^x|-x", "X").replaceAll("^y|-y", "Y").replaceAll("^z|-z", "Z")}</defaultValue>
      </requiredProperty>

       

      to have a camel case version of the 2 first properties.

      For camelCaseAPIName property, it works because it uses artifactId property which is same as apiName. But for camelCaseResourceName it doesn't works because resourceName property is not added in velocity context. Only requiredProperty with no value and default value are set in velocity context.

      See org.apache.maven.archetype.ui.generation.DefaultArchetypeGenerationConfigurator.configureArchetype(ArchetypeGenerationRequest, Boolean, Properties) line 262.

       

      Could we have velocity context extended to property with value and no default value?

       

      Best Regards.

      Attachments

        Activity

          People

            elharo Elliotte Rusty Harold
            esteban.dugueperoux Esteban DUGUEPEROUX
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: