Class PomFileGenerator

All Implemented Interfaces:
Generator, Renamable, ResourceProvider

public class PomFileGenerator extends AbstractGenerator

A Generator (mainly) for POM files. In response to requests for PomFile this generator produces a Maven Model containing basic project information. The following properties are used:

Dependencies in the model are evaluated by querying the project's providers.

Compile dependencies are evaluated as follows:

  • Resources of type MvnRepoDependency are obtained from providers associated via Supply and Expose that are not projects. These resources are Maven repository dependencies declared by the project itself.

  • Projects associated via Supply and Expose dependencies are then queried for resources of type MvnRepoDependency using their Supply dependencies. This yields the Maven repository coordinates of projects required for compilation.

Runtime dependencies are evaluated as follows:

  • Resources of type MvnRepoDependency are obtained from providers associated via Reveal that are not projects. These resources represent Maven repository dependencies declared by the project itself.

  • Projects associated via Reveal dependencies are then queried for resources of type MvnRepoDependency using their Supply dependencies. This yields the Maven repository coordinates of projects required at runtime.

The resulting model is passed to adaptPom(Consumer) for project specific customization before it is written to the POM file.

In addition to handling PomFile requests, this generator also responds to requests for MvnRepoDependencies. In this case, it returns Maven coordinates derived from the properties MvnProperties.GroupId, MvnProperties.ArtifactId and Project.Properties.Version (see above). This reflects the assumption that a project with a POM file is intended to be released as a Maven artifact. Other projects in a multi-project build will therefore ultimately depend on the Maven artifact to be released.