title: Maven property referencing a list
body: <p>I am working with a (custom, internally developed, details do not matter here) Maven plugin which takes a list of names, like this:</p>
  
  <pre><code>&lt;configuration&gt;
      &lt;names&gt;
          &lt;name&gt;Alice&lt;/name&gt;
          &lt;name&gt;Bob&lt;/name&gt;
          &lt;name&gt;Joe&lt;/name&gt;
          &lt;name&gt;Sally&lt;/name&gt;
      &lt;/names&gt;
      ...
  </code></pre>
  
  <p>The list is hard-coded in the POM file.</p>
  
  <p>I'd like to have something a little more dynamic, so that I can use a user-defined variable to specify a single name. I can do it this way:</p>
  
  <blockquote>
    <p>mvn clean package -Dname=Bob</p>
  </blockquote>
  
  <pre><code>&lt;configuration&gt;
      &lt;names&gt;
          &lt;name&gt;${name}&lt;/name&gt;
      &lt;/names&gt;
  </code></pre>
  
  <p>The problem is that the only way I've found so far to do this is to have two profiles with duplicate plugin configurations: one with the pre-defined list, and one with the single user-defined value:</p>
  
  <pre><code>&lt;profiles&gt;
    &lt;profile&gt;
      &lt;id&gt;default&lt;/id&gt;
          ...
          &lt;configuration&gt;
            &lt;names&gt;
                &lt;name&gt;Alice&lt;/name&gt;
                &lt;name&gt;Bob&lt;/name&gt;
                &lt;name&gt;Joe&lt;/name&gt;
                &lt;name&gt;Sally&lt;/name&gt;
            &lt;/names&gt;
          ...
    &lt;/profile&gt;
  
    &lt;profile&gt;
      &lt;id&gt;single-value&lt;/id&gt;
      &lt;activation&gt;
        &lt;property&gt;
          &lt;name&gt;name&lt;/name&gt;
        &lt;/property&gt; 
      &lt;/activation&gt;
      ...
        &lt;configuration&gt;
          &lt;names&gt;
            &lt;name&gt;${name}&lt;/name&gt;
          &lt;/names&gt;
      ...
    &lt;/profile&gt;
  &lt;/profiles&gt;
  </code></pre>
  
  <p>This works, but my problem with it is that both profiles have almost completely identical configurations (and they are rather lengthy configurations as well) for this plugin, <em>except for the list of names</em>.</p>
  
  <p>What I'd like to do is have a Maven property contain a list, rather than a single value. Something like this:</p>
  
  <pre><code>&lt;project&gt;
    &lt;properties&gt;
      &lt;names&gt;
        &lt;name&gt;bob&lt;/name&gt;
      &lt;/names&gt;
    &lt;/properties&gt;
    ...
  </code></pre>
  
  <p>So that my <code>single-value</code> profile will simple redefine the <code>names</code> property. But of course, this doesn't work so easily: the code sample above produces a non-parseable POM error.</p>
  
  <p>Is there any way to do what I want with some other Maven plugin, or trick?</p>