You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Martin Grigorov (JIRA)" <ji...@codehaus.org> on 2014/08/11 22:20:11 UTC
[jira] (ARCHETYPE-274) Conditionally include or exclude a file from
archetype during generation
[ https://jira.codehaus.org/browse/ARCHETYPE-274?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=351307#comment-351307 ]
Martin Grigorov commented on ARCHETYPE-274:
-------------------------------------------
Here is how I solved/workarounded similar issue: https://git-wip-us.apache.org/repos/asf?p=wicket.git;a=commitdiff;h=1c2661a6;hp=520aea93bd8bf87886bf307ac2f052d06a1a1d71
Our issue is explained here: https://issues.apache.org/jira/browse/WICKET-5671.
Our archetype by default has 'src/main/resources/log4j.properties'. We needed to remove it when deploying in Wild Fly (JBoss 8.x) because otherwise it refuses to log any application specific logs. So with the above change if -Dlog4j.properties is specified then we use the value as the new name of the file. If this system property is skipped then the default is taken into account. So the file is neither added nor removed dynamically - it just has custom name depending on the property.
> Conditionally include or exclude a file from archetype during generation
> ------------------------------------------------------------------------
>
> Key: ARCHETYPE-274
> URL: https://jira.codehaus.org/browse/ARCHETYPE-274
> Project: Maven Archetype
> Issue Type: Improvement
> Components: Generator
> Affects Versions: 2.0-alpha-4
> Reporter: Dan Allen
>
> 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?
--
This message was sent by Atlassian JIRA
(v6.1.6#6162)