title: How to automatically generate lexer+parser with ANTLR4 and Maven?
body: <p>I'am new to ANTLR4, and it seems that there is no Eclipse-Plug-In for v4. So it would nice to build automatically the Java sources from the .g4 grammars. I have a simple, empty Maven-project with src/main/java, src/test/java. Where to place the .g4 files? How can I automatically build the grammars with Maven?</p>
  
  <p>My own POM-test failed:</p>
  
  <pre><code>&lt;repository&gt;
      &lt;id&gt;mvn-public&lt;/id&gt;
      &lt;name&gt;MVNRepository&lt;/name&gt;
      &lt;url&gt;http://mvnrepository.com&lt;/url&gt;
  &lt;/repository&gt;
  
  ...
  
  &lt;build&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.antlr&lt;/groupId&gt;
              &lt;artifactId&gt;antlr4-maven-plugin&lt;/artifactId&gt;
              &lt;version&gt;4.0.0&lt;/version&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;antlr&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  </code></pre>
  
  <p>Eclipse says:</p>
  
  <pre><code>Failure to find org.antlr:antlr4-maven-plugin:pom:4.0.0 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of
  central has elapsed or updates are forced
  </code></pre>