------ Guide to generating Sources ------ Jason van Zyl ------ 2005-10-12 ------ ~~ Licensed to the Apache Software Foundation (ASF) under one ~~ or more contributor license agreements. See the NOTICE file ~~ distributed with this work for additional information ~~ regarding copyright ownership. The ASF licenses this file ~~ to you under the Apache License, Version 2.0 (the ~~ "License"); you may not use this file except in compliance ~~ with the License. You may obtain a copy of the License at ~~ ~~ http://www.apache.org/licenses/LICENSE-2.0 ~~ ~~ Unless required by applicable law or agreed to in writing, ~~ software distributed under the License is distributed on an ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY ~~ KIND, either express or implied. See the License for the ~~ specific language governing permissions and limitations ~~ under the License. ~~ NOTE: For help with the syntax of this file, see: ~~ http://maven.apache.org/doxia/references/apt-format.html 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 <<>> phase like the Antlr plugin: %{snippet|id=generate-sources-0|url=http://svn.codehaus.org/mojo/trunk/mojo/antlr-maven-plugin/src/main/java/org/codehaus/mojo/antlr/AntlrPlugin.java} The first two lines say "I want to be fit into the generate-sources phase and my 'handle' is generate". So this is all fine and dandy, we have a plugin that wants to generate some sources from a Antlr grammar but how do we use it. You need to specify that you want to use it in your POM: +----+ ... org.apache.maven.plugins maven-antlr-plugin 2.0-beta-1 java.g generate ... +----+ If you then type "mvn compile" Maven will walk through the {{{../introduction/introduction-to-the-lifecycle.html}lifecycle}} and will eventually hit the <<>> phase and see you have a plugin configured that wants to participate in that phase and the Antlr plugin is executed with your given configuration.