title: Conditionally include exclude files while creating project using maven archetype
body: <p>Am trying to create an archetype which will conditionally include file based on the user input. 
  <br />
  <br />
  Like for eg., if a user will use this custom archetype and pass parameters like 
  <br />  <strong>-DprojectType=webProject</strong> or <strong>-DprojectType=webDBProject</strong></p>
  
  <p><br/> if webProject copy only files related to webProject and if its webDBProject copy files related to webProject and DB related files.</p>
  
  <p>I found out that conditionally include/exclude file is not possible at least in near future using archetype-descriptor. </p>
  
  <p><a href="https://stackoverflow.com/questions/1919704/how-do-i-conditionally-include-or-exclude-a-file-from-an-archetype-when-project">How do I conditionally include or exclude a file from an archetype when project is generated?</a></p>
  
  <p>The other option i had was to execute a goal after archetype generation and include/remove unwanted files. But we can't utilize the eclipse M2E plugin with this.</p>
  
  <p>The final option i was trying is to utilize velocity template itself to execute the post processing operations. </p>
  
  <p>Since we can't instantiate an object inside velocity template, I was trying to use reflection to create a file instance and delete some file like the following,</p>
  
  <pre class="lang-java prettyprint-override"><code>$somestring.getClass().forName("java.io.File").getMethod("delete", null).invoke($somestring.getClass().forName("java.io.File").getConstructor($somestring.getClass()).newInstance("delete.txt"), null)
  </code></pre>
  
  <p>writing the above line in a velocity template file and running against a standalone velocity java program is running fine. But the same is not working when executing as part of maven archetype generator.</p>
  
  <p>I tried to go step by step, where the execution was successful until getting the class but the getConstructor() part is failing to execute while running archetype:generate.</p>
  
  <p>Did anyone tried and know the reason or have alternate solution?</p>
  
  <p>Also anyone knows what version of velocity engine being used in Maven ?</p>