title: Using Eclipse Java Compiler (ecj) in maven builds
body: <p>Eclipse uses it's own compiler (ECJ) to compile Java code. Debugging a program compiled with Eclipse is easier, because simple code changes can be applied instantly (by the hot code replacement).</p>
  
  <p>Maven on the other hand uses (by default) oracle JDK, that generates different byte code preventing hot code replacement in a Eclipse debug session.</p>
  
  <p>So I would like to use Eclipse ECJ compiler with my maven build, if I plan to debug the program. A convenient way for me would be a "ecj" profile:</p>
  
  <ul>
  <li><p>Compile release</p>
  
  <pre><code>$ mvn package
  </code></pre></li>
  <li><p>Compile snapshot with enabled hot code replacement</p>
  
  <pre><code>$ mvn -P ecj package
  </code></pre></li>
  </ul>
  
  <p>Also the profile activation can be specified in <code>settings.xml</code> or even Eclipse project properties.</p>
  
  <p>My questions are:</p>
  
  <ol>
  <li>Is this the right way to go?</li>
  <li>How this can be configured?</li>
  <li>Can maven toolchain be used for this?</li>
  </ol>