Maven archetype: Boolean properties

377 Views Asked by At

Can I implement the following in a Maven archetype:

If a certain property is set to true, then a package should be generated (otherwise not).

1

There are 1 best solutions below

0
On

Maven Archetype allows you to execute groovy script after generation. Check Post-generation script section.

  • Generate you classes as following:
    #if ( $doGenerate )
    // your content here
    #else
    *DELETE*
    #end
  • Create simple script which go through all the files and delete some if it content has *DELETE* marker.