title: Define sourceDirectory in Maven profiles
body: <p>In my pom.xml file, I have:</p>
  
  <pre><code>&lt;build&gt;
      &lt;sourceDirectory&gt;src&lt;/sourceDirectory&gt;
      &lt;resources&gt; .. &lt;/resources&gt;
      &lt;plugins&gt; .. &lt;/plugins&gt;
  &lt;/build&gt;
  </code></pre>
  
  <p>However, When I try to use maven profiles:</p>
  
  <pre><code> &lt;profiles&gt;
      &lt;profile&gt;
          &lt;id&gt;profileId&lt;/id&gt;
          &lt;build&gt;
              &lt;sourceDirectory&gt;src&lt;/sourceDirectory&gt;
              &lt;resources&gt; .. &lt;/resources&gt;
              &lt;plugins&gt; .. &lt;/plugins&gt;
          &lt;/build&gt;
      &lt;/profile&gt;
   &lt;/profiles&gt;
  </code></pre>
  
  <p>Maven gives me an error saying:</p>
  
  <pre><code>Unrecognised tag: 'sourceDirectory' (position: START_TAG seen ...&lt;build&gt;\r\n                &lt;sourceDirectory&gt;... @14:34) 
  </code></pre>
  
  <p>Why wouldn't it let me define a source directory within a profile? Is there a way to define sourceDirectory in profiles?</p>