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

Conditionally include or exclude a file from archetype during generation

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.0-alpha-4
    • None
    • Generator
    • None

    Description

      I would like to be able to control which files are placed into the generated project based on the value of a property that is defined during archetype:generate. For instance, I forsee the following prompt:

      Define value for groupId: : com.example
      Define value for artifactId: : myproject
      Define value for package: com.example: :
      Define value for extraSupport: : y

      Based on the value of extraSupport, I want to include (or not include) a file in the generated project. If the user does not want the extra support, I don't want to clutter up the generated project with unnecessary files.

      It's all about customization of the project based on what the developer intends to use. While I could create a whole other archetype, sometimes the changes are so slight that it would be easier to include/exclude a file.

      Is there a way to control this behavior using the archetype-metadata.xml descriptor?

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              dan.j.allen Dan Allen
              Votes:
              19 Vote for this issue
              Watchers:
              18 Start watching this issue

              Dates

                Created:
                Updated: