------ Pom ------ Brett Porter Hervé Boutemy Paul Gier ------ 2009-05-06 ------ ~~ 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 Introduction The pom task can be used in one of two ways, either to read an existing pom file (typically pom.xml), or to define an in memory pom object. Either technique can be used to resolve build dependencies, build the project classpath, and/or define project properties. Reading an existing POM file An example pom is provided here: ----- 4.0.0 com.mycompany.project project-model 1.0-SNAPSHOT junit junit 3.8.2 test org.codehaus.modello modello-core 1.0-alpha-2-SNAPSHOT javax.servlet servlet-api 2.4 provided ----- These elements represent: * - this is the version of the POM layout in use, currently <<<4.0.0>>>. * - the group ID represents your organisation and project name, much like a Java package name. This must be universally unique. This becomes the base directory in the repository as well. * - the artifact ID represents the current build unit. It usually equals the filename of the resulting file, and must be unique within the group. * - the version of the artifact you are building. * - the artifacts that this project is dependent on. This is all that is required for most projects. However, it is also possible to use other fields available in Maven to describe your project, and reference them from your build script. Once the pom file is created, it can be read by the pom task. ----- ----- Defining a POM in Ant If a POM file is not available, the ant task can also be used to define an in-memory pom. ---- ---- Accessing POM information To access a part of the POM as an Ant property, you must define it as a reference. For example, to access the version from a POM, you can use the following: ----- The version is ${mypom.version} ----- You can also access nested parts of the POM. For example, you can read the default value of the <<>> element within the <<>> element using a <<<.>>> separator. ----- The build directory is ${mypom.build.directory} ----- For more information on the elements available in the POM, see the {{{http://maven.apache.org/ref/current/maven-model/maven.html} descriptor reference}}. Accessing dependencies in the POM The <<>> task can be used in combination with the <<>> task to declare a list of dependencies. ----- ----- In this example, the <<>> task will resolve the list of dependencies in the pom and add them to the fileset. Using profiles in the POM POM profiles can be activated or deactivated using the nested profile element. For example to activate a profile called <<>>. ----- ----- This can also be used to deactivate a POM profile that is active by default. ----- -----