title: Always Using Maven `clean` Goal?
body: <p>Should the Maven <code>clean</code> goal be applied to every build as a best practice to avoid stale CLASS files? Or perhaps always using <code>clean</code> is unnecessary since Maven is smart enough to know which source code needs to be re-compiled based on changes?</p>
  
  <ul>
  <li>compile</li>
  <li>install</li>
  <li>etc?</li>
  </ul>
  
  <p>Gareth Davis pointed out the potential danger of forgetting to running a <code>clean</code> after re-naming a CLASS file - <a href="https://stackoverflow.com/a/4662536/409976">https://stackoverflow.com/a/4662536/409976</a>.</p>
  
  <p>Example: </p>
  
  <ol>
  <li>Compile module (not whole project) - Foo.java -> target/Foo.class</li>
  <li>Re-name to Bar.java &amp; re-compile module -> target/{Foo.class, Bar.class} </li>
  <li>re-compile <code>main</code></li>
  <li>BOOM – other module code should’ve failed to compile since it relied on making a Foo class (but it still longer exists since we didn’t clean).</li>
  </ol>
  
  <p>I'm looking into whether the absence of <code>clean</code> will improve build performance on a guest VM within a shared directory. However, I'm not aware of all of the consequences of <strong>not</strong> always calling the <code>clean</code> step first.</p>