Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

DECISION: The 5.0.0 POM will remove the distinction between build and reporting relying rather on lifecycle specific binding declarations

AFFECTS: 

 

Project Object Model

<project> element

The Project Object Model consists of a top level <project> tag with child elements

Code Block
xml
xml
<project modelVersion="5.0.0" [groupId="..."] artifactId="..." [version="..."] template="...">
  [<parent [groupId="..."] [artifactId="..."] [version="..."] [relativePath="..."]/>]
  ...
</project>

The following are mandatory elements:

  • modelVersion attribute - containing the model version of the POM.
  • artifactId attribute - containing the artifactId of the project
  • template attribute - containing the identifier of the template / packaging that will be used as the initial basis for this project's conventions

The following are optional elements:

  • groupId attribute - containing the groupId of the project. If this attribute is missing then the parent element must be present and the groupId will be inherited from the parent project.
  • version attribute - containing the version of the project. If this attribute is missing then the parent element must be present and the version will be inherited from the parent project.
  • parent element - containing at a minimum either the GAV of the parent project or the relative path to the parent project. Where more than the minimum required information is supplied, the additional information will be used to validate the parent project reference.

<parent> element

The parent element identifies the parent project from which conventions will be inherited.

Code Block
xml
xml
<parent [groupId="..."] [artifactId="..."] [version="..."] [relativePath="..."]/>

Technically from a schema perspective all attributes are optional, however there are two minimum valid sets of attributes:

  • If the relativePath attribute is present, no other attributes are required:

    Code Block
    xml
    xml
    <parent relativePath="..."/>

    This indicates that the parent project can be found on disk at the supplied relative path and the conventions should be inherited from that project. Specifying the additional attributes of groupId or artifactId while the version attribute is unspecified will indicate that the build should fail if the project at the supplied relative path does not match the specified groupId or artifactId. If all three of the groupIdartifactId and version attributes are missing then a mismatch at the supplied relative path will not be fatal as the parent can be resolved from the reactor/repository.

  • Specifying the GAV of the parent project:

    Code Block
    xml
    xml
    <parent groupId="..." artifactId="..." version="..."/>

    This indicates that the parent project should be resolved from the reactor / repository. If the relativePath element is present then in prior to the the reactor / repository the project at the specified relative path will be validated against the supplied groupIdartifactId and version and used in the event of a match.

The following are the attributes:

  • groupId attribute - containing the groupId of the parent project. 
  • artifactId attribute - containing the artifactId of the parent project
  • version attribute - containing the version of the parent project. 
  • relativePath attribute - containing the relative path to the parent project.

 

 

TODO write this up... I'm just dumping stuff I have done on the mail thread here to make it easier to collaborate:

Code Block
xml
xml
<project modelVersion="5.0.0" [groupId="..."] artifactId="..." [version="..."] template="...">
  [<parent groupId="..." artifactId="..." [version="..."] [relativePath="...']/>]

  [<mixin groupId="..." artifactId="..." [version="..."]/>]
  [<mixin groupId="..." artifactId="..." [version="..."]/>]
  ...
  [<mixin groupId="..." artifactId="..." [version="..."]/>]

  [<lifecycle id="..." mode="override|inherit">
    <phase id="..." [after="..." | before="..."]/>
    <phase id="..." [after="..." | before="..."]/>
    ...
    <phase id="..." [after="..." | before="..."]/>

  </lifecycle>]
  [<lifecycle id="...">
    ...
  </lifecycle>]
  ...
  [<lifecycle id="...">
    ...
  </lifecycle>]

  [<scope id="compile" [mode="override|inherit"]>
    <dependency groupId="..." artifactId="..." [platformId="..."] version="..." [classifier="..."] type="..."/> <!-- type is mandatory-->
    <dependency groupId="..." artifactId="..." [platformId="..."] version="..." [classifier="..."] type="..."/>
    ...
    <dependency groupId="..." artifactId="..." [platformId="..."] version="..." [classifier="..."] type="..."/>
  </scope>]
  [<scope id="...">
    ...
  </scope>]
  ...
  [<scope id="...">
    ...
  </scope>]

  [<extensions [mode="override|inherit"]>
    <extension groupId="..." artifactId="..." version="..."/>
    ...
  </extensions>]
  [<plugins [mode="override|inherit"]>
    <!-- this is what pluginManagement was -->
    <plugin groupId="..." artifactId="..." version="...">
      ...
    </plugin>
    ...
  </plugins>]

  [<bindings [mode="override|inherit"]>
    <!-- this is what plugins was, we make explicit here that this is the binding of executions into the lifecycles -->
  </bindings>]

  [<platform id="..." [mode="override|inherit"]>
    <activation>
      <!-- define how we determine that this platform can be built in the current environment -->
    </activation>
    <!-- allow platform specific mixins -->
    [<mixin groupId="..." artifactId="..." [version="..."]/>]
    <!-- allow platform specific lifecycles -->
    [<lifecycle id="...">
      ...
    </lifecycle>]

    <!-- allow platform specific dependencies -->
    [<scope>
      ...
    </scope>]

    <!-- allow platform specific bindings... but plugin management is from the root only -->
    [<bindings>
      ...
    </bindings>]

    <!-- allow most of the other root tags except platform and packaging and deployment config -->
  </platform>]
  [<platform id="...">
    ...
  </platform>]
  ...
  [<platform id="...">
    ...
  </platform>]

  <!-- packaging is only allowed in poms with an id of "parent" or "mixin". It allows a parent/mixin to be used by different packaging ids and define specialized defaults -->
  [<packaging id="...">
    [<mixin groupId="..." artifactId="..." [version="..."]/>]
    <!-- allow platform specific lifecycles -->
    [<lifecycle id="...">
      ...
    </lifecycle>]

    <!-- allow platform specific dependencies -->
    [<scope>
      ...
    </scope>]

    <!-- allow platform specific bindings... but plugin management is from the root only -->
    [<bindings>
      ...
    </bindings>]

    <!-- allow most of the other root tags except platform and packaging and deployment config -->
  </packaging>]
  [<packaging id="...">
    ...
  </packaging>]
  ...
  [<packaging id="...">
    ...
  </packaging>]

  <!-- unsure if we still need profiles -->
  <!-- perhaps we still need properties -->
  <!-- TBD deployment config, repositories, etc -->

</project>
 

...