Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I create dynamically named folders with Maven Archetype?
    text
    copied!<p>I'm trying to build an archetype structure like this, a webapp with some custom folders for our web framework. Especially some dynamic folders which also will contain some files brought by the archetype.</p> <pre><code>└───src └───main └───webapp └───WEB-INF ├───cfg │ ├───log4j │ └───resources │ └───extensions │ ├───${shortName}-business │ └───${shortName}-layout └───lib </code></pre> <p>I added a required property to my <code>archetype-metadata.xml</code> to have an short name for the project, which is used among other things for generating unique folders.</p> <pre><code>&lt;requiredProperties&gt; &lt;requiredProperty key="shortName" /&gt; &lt;/requiredProperties&gt; </code></pre> <p>The property <code>shortName</code> I use in a <code>fileSet</code>:</p> <pre><code>&lt;fileSet&gt; &lt;directory&gt;[..]/resources/extensions/${shortName}-business&lt;/directory&gt; &lt;/fileSet&gt; &lt;fileSet&gt; &lt;directory&gt;[..]/resources/extensions/${shortName}-layout&lt;/directory&gt; &lt;/fileSet&gt; </code></pre> <hr> <p>The command to generate the archetype:</p> <pre><code>mvn archetype:generate -B \ -DgroupId=com.stackoverflow \ -DartifactId=stackoverflow-question -DarchetypeGroupId=com.stackoverflow \ -DarchetypeArtifactId=stackoverflow-archetype -DarchetypeVersion=1.0 \ -DshortName=soq </code></pre> <p>I assume to get the following folder structure:</p> <pre><code>..\ ├───soq-business └───soq-layout </code></pre> <p>But I get this name <code>${shortName}-business</code> as folder, without it being replaced with the property.</p> <pre><code>..\ ├───${shortName}-business └───${shortName}-layout </code></pre> <p>How can I achieve this? How can I place files below <code>soq-business</code> without knowing the folder name at this time?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload