title: Maven 3 regression: Profile dependencies lost?
body: <p>I observed a change behavior between Maven 2 and Maven 3. Is this a bug or a feature? I couldn't find anything in the <a href="https://cwiki.apache.org/MAVEN/maven-3x-compatibility-notes.html" rel="nofollow">Maven 3.x Compatibility Notes</a></p>
  
  <p>I use two different profiles to add dependencies for different environment in a multi-module project.</p>
  
  <p>parent-pom:</p>
  
  <pre><code>&lt;project&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;group&lt;/groupId&gt;
      &lt;artifactId&gt;main&lt;/artifactId&gt;
      &lt;packaging&gt;pom&lt;/packaging&gt;
      &lt;version&gt;1.0.0-SNAPSHOT&lt;/version&gt;
  
      &lt;modules&gt;
          &lt;module&gt;common&lt;/module&gt;
          &lt;module&gt;portal&lt;/module&gt;
      &lt;/modules&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>The common-pom has the profile in it:</p>
  
  <pre><code>&lt;project&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;group&lt;/groupId&gt;
      &lt;artifactId&gt;common&lt;/artifactId&gt;
      &lt;packaging&gt;jar&lt;/packaging&gt;
      &lt;version&gt;1.0.0-SNAPSHOT&lt;/version&gt;
      &lt;parent&gt;
          &lt;groupId&gt;group&lt;/groupId&gt;
          &lt;artifactId&gt;main&lt;/artifactId&gt;   
          &lt;version&gt;1.0.0-SNAPSHOT&lt;/version&gt;
          &lt;relativePath&gt;../pom.xml&lt;/relativePath&gt;
      &lt;/parent&gt;   
      &lt;profiles&gt;
          &lt;profile&gt;
              &lt;id&gt;development&lt;/id&gt;
              &lt;dependencies&gt;
                  &lt;dependency&gt;
                      &lt;groupId&gt;log4j&lt;/groupId&gt;
                      &lt;artifactId&gt;log4j&lt;/artifactId&gt;
                      &lt;version&gt;1.2.14&lt;/version&gt;
                  &lt;/dependency&gt;
              &lt;/dependencies&gt;
          &lt;/profile&gt;
          &lt;profile&gt;
              &lt;id&gt;production&lt;/id&gt;
              &lt;dependencies&gt;
                  &lt;dependency&gt;
                      &lt;groupId&gt;commons-logging&lt;/groupId&gt;
                      &lt;artifactId&gt;commons-logging&lt;/artifactId&gt;
                      &lt;version&gt;1.1.1&lt;/version&gt;
                  &lt;/dependency&gt;
              &lt;/dependencies&gt;
          &lt;/profile&gt;
      &lt;/profiles&gt; 
  &lt;/project&gt;
  </code></pre>
  
  <p>The portal-pom has only the common dependency and should include the transitive dependency from the common module:</p>
  
  <pre><code>&lt;project&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;group&lt;/groupId&gt;
      &lt;artifactId&gt;portal&lt;/artifactId&gt;
      &lt;packaging&gt;war&lt;/packaging&gt;
      &lt;version&gt;1.0.0-SNAPSHOT&lt;/version&gt;
      &lt;parent&gt;
          &lt;groupId&gt;group&lt;/groupId&gt;
          &lt;artifactId&gt;main&lt;/artifactId&gt;   
          &lt;version&gt;1.0.0-SNAPSHOT&lt;/version&gt;
          &lt;relativePath&gt;../pom.xml&lt;/relativePath&gt;
      &lt;/parent&gt;
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;group&lt;/groupId&gt;
              &lt;artifactId&gt;common&lt;/artifactId&gt;
              &lt;version&gt;1.0.0-SNAPSHOT&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>Building this project (from the parent) via Maven2 <code>mvn -P production package</code> results in a WAR which includes the transitive dependency. (I used those simple dependencies for easy reproduction)
  Executing via Maven3, I get only the common.jar in the WAR, but not the transitive dependency.</p>
  
  <p>Is this a desired behavior?</p>
  
  <p>To make things even "interesting": If one of the profiles is activated by default (explicit in the common-pom as the activation is not derived from the parent to the child modules) these transitive dependencies are always add to the portal.
  But filtering or property-setting via profiles works as expected.</p>