------ Usage ------ Kenney Westerhof, Franz Allan Valencia See, Vincent Siveton ------ September 2006 ------ ~~ 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 Usage * Run The maven-antrun-plugin has only one goal, <<>>. This allows Maven 2 to run Ant tasks. To do so, there must be an existing project and maven-antrun-plugin must have its <<<\>>> tag configured (although it would still execute without the <<<\>>> tag, it would not do anything). Below is the template for <<>>'s <<>>. ------ [...] maven-antrun-plugin run [...] ------ Moreover, you can add a script to each lifecycle phase, by duplicating the <<<\>>> section and specifying a new phase. Ultimately, you could specify some Ant {{{http://ant.apache.org/manual/using.html#targets}<<<\>>>}} attributes in the <<<\>>> tag. Only <<>> attribute in Ant <<<\>>> is not wrapped. ------ [...] [...] ------ Below you can see how to indicate that Ant has generated some more java source that needs to be included in the compilation phase. Note that the compile phase follows the <<>> phase in the lifecycle. ------ [...] [...] maven-antrun-plugin generate-sources ${project.build.directory}/generated-sources/main/java ${project.build.directory}/generated-sources/test/java run [...] ------ Of course, you can put whatever folder you prefer. The folders in the example above are handy because they are deleted when you <<>> since they are in the build directory (which is, by default, "target"). <<<\>>> adds a single folder to the list of folders that get compiled with the program source code (<<>>). <<<\>>> adds a single folder to the list of folders that get compiled with the test source code (<<>>). * Ant Expressions to Maven Expressions Mapping Some Ant expressions have their respective counterparts in Maven. Thus, one can simply invoke the corresponding Maven expression instead of using maven-antrun-plugin to avoid the unneccessary overhead. *-----------------------------------+-----------------------------------+ | <> | <> | *-----------------------------------------------------------------------+ | Built-in Tasks | *-----------------------------------+-----------------------------------+ | <<>> | {{{../maven-antrun-plugin/}<<>>}} | *-----------------------------------+-----------------------------------+ | <<>> | {{{../maven-antrun-plugin/}<<>>}} | *-----------------------------------+-----------------------------------+ | <<>> | {{{http://maven.apache.org/guides/introduction/introduction-to-profiles.html}<<>>}} | *-----------------------------------+-----------------------------------+ | <<>> | {{{../maven-assembly-plugin/}<<>>}} | *-----------------------------------+-----------------------------------+ | <<>> | {{{../maven-assembly-plugin/}<<>>}} | *-----------------------------------+-----------------------------------+ | <<>> | {{{../maven-assembly-plugin/}<<>>}} | *-----------------------------------+-----------------------------------+ | <<>> | {{{http://maven.apache.org/guides/introduction/introduction-to-profiles.html}<<>>}} | *-----------------------------------+-----------------------------------+ | <<>> | {{{../maven-resources-plugin/}<<>>}} | *-----------------------------------+-----------------------------------+ | <<>> | {{{../maven-dependency-plugin/}<<>>}} | *-----------------------------------+-----------------------------------+ | <<>> | {{{../maven-ear-plugin/}<<>>}} | *-----------------------------------+-----------------------------------+ | <<>> | {{{../maven-resources-plugin/}<<>>}} | | | | *-----------------------------------+-----------------------------------+ | <<>> | {{{../maven-resources-plugin/}<<>>}} | *-----------------------------------+-----------------------------------+ | <<>> | {{{../maven-jar-plugin/}<<>>}} | *-----------------------------------+-----------------------------------+ | <<>> | {{{../maven-assembly-plugin/}<<>>}} | *-----------------------------------+-----------------------------------+ | <<>> | {{{../maven-assembly-plugin/}<<>>}} | *-----------------------------------+-----------------------------------+ | <<>> | {{{../maven-jar-plugin/}<<>>}} | *-----------------------------------+-----------------------------------+ | <<>> | {{{../maven-compiler-plugin/}<<>>}} | *-----------------------------------+-----------------------------------+ | <<>> | {{{../maven-javadoc-plugin/}<<>>}} | *-----------------------------------+-----------------------------------+ | <<>> | {{{../maven-resources-plugin/}<<>>}} | *-----------------------------------+-----------------------------------+ | <<>> | {{{../maven-jar-plugin/}<<>>}} | *-----------------------------------+-----------------------------------+ | <<>> | {{{../maven-resources-plugin/}<<>>}} | *-----------------------------------+-----------------------------------+ | <<>> | {{{../maven-resources-plugin/}<<>>}} | | | | *-----------------------------------+-----------------------------------+ | <<>> | {{{../maven-assembly-plugin/}<<>>}} | *-----------------------------------+-----------------------------------+ | <<>> | {{{../maven-assembly-plugin/}<<>>}} | *-----------------------------------+-----------------------------------+ | <<>> | {{{../maven-assembly-plugin/}<<>>}} | *-----------------------------------+-----------------------------------+ | <<>> | {{{../maven-assembly-plugin/}<<>>}} | *-----------------------------------+-----------------------------------+ | <<>> | {{{../maven-assembly-plugin/}<<>>}} | *-----------------------------------+-----------------------------------+ | <<>> | {{{../maven-war-plugin/}<<>>}} | *-----------------------------------+-----------------------------------+ | <<>> | {{{../maven-assembly-plugin/}<<>>}} | *-----------------------------------+-----------------------------------+ Optional Tasks | *-----------------------------------+-----------------------------------+ | <<>> | {{{../maven-antlr-plugin/}<<>>}} | *-----------------------------------+-----------------------------------+ | <<>> | {{{../maven-dependency-plugin/}<<>>}} | *-----------------------------------+-----------------------------------+ | <<>> | {{{../maven-ejb-plugin/}<<>>}} | *-----------------------------------+-----------------------------------+ | <<>> | {{{../maven-deploy-plugin/}<<>>}} | | | | *-----------------------------------+-----------------------------------+ | <<>> | {{{../maven-compiler-plugin/}<<>>}} | *-----------------------------------+-----------------------------------+ | <<>> | {{{../maven-compiler-plugin/}<<>>}} | *-----------------------------------+-----------------------------------+ | <<>> | {{{../maven-compiler-plugin/}<<>>}} | *-----------------------------------+-----------------------------------+ | <<>> | {{{../maven-surefire-plugin/}<<>>}} | *-----------------------------------+-----------------------------------+ | <<>> | {{{../maven-surefire-report-plugin/}<<>>}} | *-----------------------------------+-----------------------------------+ | <<>> | {{{../maven-deploy-plugin/}<<>>}} | *-----------------------------------+-----------------------------------+ | <<>> | {{{../maven-deploy-plugin/}<<>>}} | *-----------------------------------+-----------------------------------+ | <<>> | {{{../maven-resources-plugin/}<<>>}} | | | | *-----------------------------------+-----------------------------------+