Guide to generating sources

Let's run though a short example to try and help. To generate sources you must first have a plugin that participates in the generate-sources phase like the ANTLR4 Maven Plugin.

So this is all fine and dandy, we have a plugin that wants to generate some sources from a Antlr4 grammar but how do we use it. You need to specify that you want to use it in your POM:


If you then type mvn compile Maven will walk through the lifecycle and will eventually hit the generate-sources phase and see you have a plugin configured that wants to participate in that phase and the ANTLR4 Maven Plugin is executed with your given configuration. Furthermore during the compile you can observe that all the generated code (from your grammar files) will automatically being compiled without supplemental configuration.