Guide to generating sources

Let's run though a short example. To generate sources you must first have a plugin that participates in the generate-sources phase like the ANTLR4 Maven Plugin. You configure its execution in the POM:


When you type mvn compile, Maven walks through the lifecycle and eventually hits the generate-sources phase. It sees that a plugin is configured that wants to participate in that phase, and executes the ANTLR4 Maven Plugin with the given configuration. Later, during the compile phase, all the code generated from the grammar files is compiled without further configuration.