~~ 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. ----- Introduction ----- Hervé Boutemy ----- 2013-03-19 ----- Maven Model Builder The effective model builder, with profile activation, inheritance, interpolation, ... The main component is <<>> ({{{./apidocs/org/apache/maven/model/building/ModelBuilder.html}javadoc}}, {{{./xref/org/apache/maven/model/building/ModelBuilder.html}source}}), with its <<>> implementation ({{{./apidocs/org/apache/maven/model/building/DefaultModelBuilder.html}javadoc}}, {{{./xref/org/apache/maven/model/building/DefaultModelBuilder.html}source}}) that manages the steps sequence. The sequence is divided into 2 phases: * phase 1 ** profile activation: see {{{./apidocs/org/apache/maven/model/profile/activation/package-summary.html}available activators}}. Notice that model interpolation hasn't happened yet, then interpolation for file-based activation is limited to <<<$\{basedir}>>> (since Maven 3), System properties and request properties ** raw model validation: <<>> ({{{./apidocs/org/apache/maven/model/validation/ModelValidator.html}javadoc}}), with its <<>> implementation ({{{./xref/org/apache/maven/model/validation/DefaultModelValidator.html}source}}) ** model normalization - merge duplicates: <<>> ({{{./apidocs/org/apache/maven/model/normalization/ModelNormalizer.html}javadoc}}), with its <<>> implementation ({{{./xref/org/apache/maven/model/normalization/DefaultModelNormalizer.html}source}}) ** profile injection: <<>> ({{{./apidocs/org/apache/maven/model/profile/ProfileInjector.html}javadoc}}), with its <<>> implementation ({{{./xref/org/apache/maven/model/profile/DefaultProfileInjector.html}source}}) ** parent resolution until {{{./super-pom.html}super-pom}} ** inheritance assembly: <<>> ({{{./apidocs/org/apache/maven/model/inheritance/InheritanceAssembler.html}javadoc}}), with its <<>> implementation ({{{./xref/org/apache/maven/model/inheritance/DefaultInheritanceAssembler.html}source}}) ** model interpolation (see below) ** url normalization: <<>> ({{{./apidocs/org/apache/maven/model/path/UrlNormalizer.html}javadoc}}), with its <<>> implementation ({{{./xref/org/apache/maven/model/path/DefaultUrlNormalizer.html}source}}) [] * phase 2, with optional plugin processing ** model path translation: <<>> ({{{./apidocs/org/apache/maven/model/path/ModelPathTranslator.html}javadoc}}), with its <<>> implementation ({{{./xref/org/apache/maven/model/path/DefaultModelPathTranslator.html}source}}) ** plugin management injection: <<>> ({{{./apidocs/org/apache/maven/model/management/PluginManagementInjector.html}javadoc}}), with its <<>> implementation ({{{./xref/org/apache/maven/model/management/DefaultPluginManagementInjector.html}source}}) ** <(optional)> lifecycle bindings injection: <<>> ({{{./apidocs/org/apache/maven/model/plugin/LifecycleBindingsInjector.html}javadoc}}), with its <<>> implementation ({{{./xref/org/apache/maven/model/plugin/DefaultLifecycleBindingsInjector.html}source}}) ** dependency management import (for dependencies of type <<>> in the <<<\>>> section) ** dependency management injection: <<>> ({{{./apidocs/org/apache/maven/model/management/DependencyManagementInjector.html}javadoc}}), with its <<>> implementation ({{{./xref/org/apache/maven/model/management/DefaultDependencyManagementInjector.html}source}}) ** model normalization - inject default values: <<>> ({{{./apidocs/org/apache/maven/model/normalization/ModelNormalizer.html}javadoc}}), with its <<>> implementation ({{{./xref/org/apache/maven/model/normalization/DefaultModelNormalizer.html}source}}) ** <(optional)> reports configuration: <<>> ({{{./apidocs/org/apache/maven/model/plugin/ReportConfigurationExpander.html}javadoc}}), with its <<>> implementation ({{{./xref/org/apache/maven/model/plugin/DefaultReportConfigurationExpander.html}source}}) ** <(optional)> reports conversion to decoupled site plugin: <<>> ({{{./apidocs/org/apache/maven/model/plugin/ReportingConverter.html}javadoc}}), with its <<>> implementation ({{{./xref/org/apache/maven/model/plugin/DefaultReportingConverter.html}source}}) ** <(optional)> plugins configuration: <<>> ({{{./apidocs/org/apache/maven/model/plugin/PluginConfigurationExpander.html}javadoc}}), with its <<>> implementation ({{{./xref/org/apache/maven/model/plugin/DefaultPluginConfigurationExpander.html}source}}) ** effective model validation: <<>> ({{{./apidocs/org/apache/maven/model/validation/ModelValidator.html}javadoc}}), with its <<>> implementation ({{{./xref/org/apache/maven/model/validation/DefaultModelValidator.html}source}}) [] [] * Model Interpolation Model Interpolation consists in replacing <<<$\{...\}>>> with calculated value. It is done in <<>> ({{{./apidocs/org/apache/maven/model/interpolation/StringSearchModelInterpolator.html}javadoc}}, {{{./xref/org/apache/maven/model/interpolation/StringSearchModelInterpolator.html}source}}). Notice that model interpolation happens profile activation, then profile activation doesn't benefit from every values: interpolation for file-based activation is limited to <<<$\{basedir}>>> (which was introduced in Maven 3 and is not deprecated in this context), System properties and request properties. Values are evaluated in sequence from different syntaxes: *----+------+------+ || value || evaluation result || common examples || *----+------+------+ | <<>>\ <<>> ()\ <<<*>>> () | POM content (see {{{../maven-model/maven.html}POM reference}}) | <<<$\{project.version\}>>>\ | | <<<$\{project.build.finalName\}>>>\ | | <<<$\{project.artifactId\}>>>\ | | <<<$\{project.build.directory\}>>> | *----+------+------+ | <<>>\ <<>> ()\ <<>> () | the directory containing the <<>> file | <<<$\{project.basedir\}>>> | *----+------+------+ | <<>>\ <<>> () | the directory containing the <<>> file as URI | <<<$\{project.baseUri\}>>> | *----+------+------+ | <<>>\ <<>> | the UTC timestamp of build start, in <<>> default format, which can be overridden with <<>> POM property | <<<$\{maven.build.timestamp\}>>> | *----+------+------+ | <<<*>>> | user properties, set from CLI with <<<-Dproperty=value>>> | <<<$\{skipTests\}>>> | *----+------+------+ | <<<*>>> | model properties, such as project properties set in the pom | <<<$\{any.key\}>>> | *----+------+------+ | <<>> | The path to the current Maven home. | <<<$\{maven.home\}>>> | *----+------+------+ | <<>> | The version number of the current Maven execution <(since 3.0.4)>. For example, "<<<3.0.5>>>". | <<<$\{maven.version\}>>> | *----+------+------+ | <<>> | The full build version of the current Maven execution <(since 3.0.4)>. For example, "<<>>". | <<<$\{maven.build.version\}>>> | *----+------+------+ | <<<*>>> | Java system properties (see {{{http://download.oracle.com/javase/6/docs/api/java/lang/System.html#getProperties()}JDK reference}}) | <<<$\{user.home\}>>>\ | | <<<$\{java.home\}>>> | *----+------+------+ | <<>>\ <<<*>>> | environment variables | <<<$\{env.PATH\}>>> | *----+------+------+ | <<>> | Local user settings (see {{{../maven-settings/settings.xml/settings.html}settings reference}}) | <<<$\{settings.localRepository\}>>> | *----+------+------+ ** Notice * after model interpolation, <<<$\{...\}>>> content can remain in the model that will be evaluated later when setting plugin parameters. This happens in particular with <<>> values for {{{../maven-settings/settings.html}Settings Model}}, * encoding configuration have been defined as POM properties looking like POM content but not added to POM model to maintain compatibility with previous Maven versions: * <<<$\{project.build.sourceEncoding\}>>> for {{{http://docs.codehaus.org/display/MAVENUSER/POM+Element+for+Source+File+Encoding}source files encoding}} (defaults to platform encoding) * <<<$\{project.reporting.outputEncoding\}>>> for {{{https://cwiki.apache.org/confluence/display/MAVENOLD/Reporting+Encoding+Configuration}reporting output files encoding}} (defaults to <<>>) [] []