2016-12-15

Issue in Eclipse with Generated Sources

So I had a maven project in eclipse, which has a few grammars, generated by ANTLR. Once in a while, eclipse goes nuts, it fails to recognize the classes in the target/generated-sources directory.

What happened to me is that it somehow reinstated a filter in the Java Build Path. Something "reverts" the .classpath file in the project root...
  1. Right click on your project,
  2. click Properties,
  3. click on Java Build Path,
  4. find your source folder with the generated sources, and you will see Excluded: ** [means exclude all]
  5. click on it,
  6. click Edit,
  7. click on the Exclusion pattern stating **,
  8. click Remove,
  9. click Finish,
  10. now you should see Excluded: (None),
  11. click Apply,
  12. click OK,
  13. rebuild :)