title: Javac does not compile classes to target folder
body: <p><strong>YES I did <code>mvn clean</code>.</strong></p>
  
  <p>Tried in Maven 3.1.0, 3.0.4 and 3.0.3</p>
  
  <p>My multi-module maven project's build (mvn install) fails at some module. The cause is that the last module was built with SUCCESS, but in fact the <strong>jar is empty</strong>. And then the next module can't find the classes that it needs to see.</p>
  
  <pre><code>[INFO] Reactor Summary:
  [INFO] 
  [INFO] myproject ......................................... SUCCESS [0.309s]
  [INFO] myproject-service ................................. SUCCESS [0.011s]
  [INFO] myproject-service-api ............................ SUCCESS [1.242s]
  [INFO] myproject-service-spi ............................ FAILURE [1.422s]
  [INFO] myproject-datap-lib-impl .................. SKIPPED
  ...
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD FAILURE
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time: 19.746s
  [INFO] Finished at: Wed Jul 24 17:30:57 EEST 2013
  [INFO] Final Memory: 62M/919M
  [INFO] ------------------------------------------------------------------------
  [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project myproject-service-spi: Compilation failure: Compilation failure:
  [ERROR] C:\dev\mything\myproject\trunk-checkout2\service\spi\src\main\java\org\myself\service\spi\validation\fake\AbstractConfigurableFakeDetector.java:[12,55] error: package org.myself.service.validation.fake does not exist
  </code></pre>
  
  <p>Here is the complete debug output from running <code>mvn -X clean install -amd -Dmaven.test.skip=true &gt; build.log</code> <a href="http://nopaste.info/7f07571993.html" rel="nofollow noreferrer">http://nopaste.info/7f07571993.html</a></p>
  
  <p>In IntelliJ IDEA it all looks good, the class exists.</p>
  
  <p>Not just the generated jar is empty, also the folder service/api/target/classes.</p>
  
  <p>My pom file for service-api is very basic, just like the others that work:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
           xmlns="http://maven.apache.org/POM/4.0.0"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;parent&gt;
          &lt;artifactId&gt;myparent&lt;/artifactId&gt;
          &lt;groupId&gt;my.parent&lt;/groupId&gt;
          &lt;version&gt;myversion&lt;/version&gt;
      &lt;/parent&gt;
  
      &lt;groupId&gt;myproject.service.api&lt;/groupId&gt;
      &lt;artifactId&gt;myproject-service-api&lt;/artifactId&gt;
  
      &lt;dependencies&gt;
          ... some local and external dependencies
      &lt;/dependencies&gt;
  
      &lt;properties&gt;
      &lt;/properties&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>No maven plugins here.</p>
  
  <p>I don't think I have a cyclic dependency, because Maven 3 would detect this.</p>
  
  <p>UPDATE </p>
  
  <p>I've now got it down to this: a simple mvn compile on the module that creates the empty jar gives me this output in IntelliJ IDEA:</p>
  
  <pre><code>[INFO]                                                                         
  [INFO] ------------------------------------------------------------------------
  [INFO] Building myproject-service-api 4.0-SNAPSHOT
  [INFO] ------------------------------------------------------------------------
  [INFO] 
  [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ myproject-service-api ---
  [INFO] Using 'UTF-8' encoding to copy filtered resources.
  [INFO] skip non existing resourceDirectory C:\myproject\trunk-checkout2\service\api\src\main\resources
  [INFO] 
  [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ myproject-service-api ---
  [INFO] Changes detected - recompiling the module!
  [INFO] Compiling 217 source files to C:\myproject\trunk-checkout2\service\api\target\classes
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD SUCCESS
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time: 3.908s
  [INFO] Finished at: Wed Jul 24 21:56:49 EEST 2013
  [INFO] Final Memory: 20M/232M
  [INFO] ------------------------------------------------------------------------
  </code></pre>
  
  <p>And right after running that, the folder C:\myproject\trunk-checkout2\service\api\target\classes is empty. So the 217 Java classes are detected, maven says it compiles them and puts them into my target folder, but it does not.</p>
  
  <p>Update 2</p>
  
  <p>I've compared the output of <code>mvn -X compile</code> of a module that works compared to this one (remember, all end in BUILD SUCCESS but this one has an empty target folder). There is a difference: the failing one lists all java files as "<strong>Stale source detected</strong>".</p>
  
  <pre><code>[DEBUG] Using compiler 'javac'.
  [DEBUG] Source directories: [C:\myproject\trunk-checkout2\service\api\src\main\java]
  [DEBUG] Classpath: [C:\myproject\trunk-checkout2\service\api\target\classes
  ... all the dependency jars
  [DEBUG] Output directory: C:\myproject\trunk-checkout2\service\api\target\classes
  [DEBUG] CompilerReuseStrategy: reuseCreated
  [DEBUG] useIncrementalCompilation enabled
  [DEBUG] Stale source detected: C:\dev\myproject\trunk-checkout2\service\api\src\main\java\my\Class.java
  ... listing all 217 classes
  [INFO] Changes detected - recompiling the module!
  [DEBUG] Classpath:
  [DEBUG]  C:\myproject\trunk-checkout2\service\api\target\classes
  ... all the dependency jars
  [DEBUG] Source roots:
  [DEBUG]  C:\myproject\trunk-checkout2\service\api\src\main\java
  [DEBUG] Command line options:
  [DEBUG] -d (...) -g -nowarn -target 1.6 -source 1.6 -encoding UTF-8
  [DEBUG] incrementalBuildHelper#beforeRebuildExecution
  [INFO] Compiling 217 source files to C:\myproject\trunk-checkout2\service\api\target\classes
  [DEBUG] incrementalBuildHelper#afterRebuildExecution
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD SUCCESS
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time: 4.060s
  [INFO] Finished at: Wed Jul 24 23:16:37 EEST 2013
  [INFO] Final Memory: 22M/328M
  [INFO] ------------------------------------------------------------------------
  </code></pre>
  
  <p>I've seen this bug report <a href="https://jira.codehaus.org/browse/MCOMPILER-205" rel="nofollow noreferrer">https://jira.codehaus.org/browse/MCOMPILER-205</a> and I do have package-info.java files in this module, but I've tried a pre-3 compiler plugin, same result. And I've tried with an annotation as described there, no luck either. So I don't think it's the same case.</p>
  
  <p>I don't have a public static void main, thus this bug <a href="https://stackoverflow.com/questions/9505857/workaround-for-javac-compilation-order-bug-in-maven">Workaround for javac compilation order bug in maven</a> can't be it.</p>
  
  <p>UPDATE 3 </p>
  
  <p>There's an abort in javac, without notice (-verbose turned on). Just 1 class works, all 217 fails. So I guess I have to try to find which causes it, etc... will post again.</p>