title: How to activate a Maven profile per pom.xml?
body: <p>I have a large Maven project with one master module and lots of children, organized in a nice tree structure. However, some of the modules need special settings which would cause misbehaviour in other modules. For example, there are modules which do stuff on Hadoop which need a Java source level of 1.7, all other Java modules use a source level of 1.8, and now Scala modules are introduced into this tree which compile with <code>scala-maven-plugin</code> which needs special settings for <code>maven-compiler-plugin</code> when compiling mixed Java/Scala modules.</p>
  
  <p>In the past I simply had a master module for the Hadoop stuff which defined the source level of 1.7 and added all necessary Hadoop dependencies. Now I want to avoid defining another master module for Hadoop stuff written in Scala, and yet another module for Non-Hadoop stuff in Scala. I thought I could use profiles, so I defined two profiles in my master POM:</p>
  
  <ul>
  <li><code>java</code> activates the <code>maven-javadoc-plugin</code></li>
  <li><code>scala</code> does not activate <code>maven-javadoc-plugin</code> but the <code>maven-scala-plugin</code> and configures it like in <a href="http://davidb.github.io/scala-maven-plugin/example_java.html" rel="nofollow">the example from its documentation</a></li>
  </ul>
  
  <p>In the master POM, the <code>java</code> profile is set as active by default, as Java is the default. When a project uses Scala, I want to activate the <code>scala</code> profile, and deactivate <code>java</code>, but setting <code>activeByDefault</code> to <code>false</code> for the <code>java</code> profile has no effect, causing compile errors.</p>
  
  <p>So, is there a way to enable a profile specific to a module without having to set it manually in each pom?</p>