Skip to content
John Casey edited this page Jul 31, 2013 · 1 revision

Relationships Between Projects

Maven's POMs express at least five different types of relationships to other projects' artifacts:

  • Parent
  • Dependency
  • Extension
  • Plugin
  • Plugin-Level Dependency (dependencies declared in the plugin section, as project-specific add-ons to the plugin classpath)

Each of these has different meaning in the build process, and may have different sets of associated information that help fine-tune when they're used even outside the build process. Each relationship type contains a ProjectVersionRef pointing to the declaring project version (which corresponds to the POM in which the relationship was expressed).

Atlas captures each of these relationships as a variant of its foundational ProjectRelationship class...

Relationship Types

ParentRelationship

Contains a basic ProjectVersionRef pointing to the project POM it references. Since POMs don't have type or classifier associated with them in Maven, there's no need to specify anything more than the project release for this relationship.

DependencyRelationship

Contains an ArtifactRef for the dependency artifact it references, along with scope (default: compile) and a flag for whether the dependency was specified in the <dependencyManagement/> section or not.

ExtensionRelationship

Contains a basic ProjectVersionRef for the extension artifact it references. Maven assumes that only main artifacts with type of jar are available as build extensions.

PluginRelationship

Contains a ProjectVersionRef for the plugin it references, along with a flag for whether the plugin was specified in the <pluginManagement/> section or not.

PluginDependencyRelationship

Contains a ProjectRef to the plugin under which it was declared, along with the ArtifactRef for what dependency artifact the declaration references. This relationship is different from DependencyRelationship because it doesn't store scope (scope is meaningless here). It also contains a flag for whether the plugin was specified in the <pluginManagement/> section or not.

Collections of Relationships

The classes in this section are usually prefixes with 'E'. This is meant to mark these classes as dealing with effective POMs. That is, the classes and relationships here don't deal with partial declarations that may be filled out through inheritance, profile activation, etc. It's assumed for now that these classes are working with complete (validatable) expressions of relationships.

Collection Types

Atlas currently defines three basic collections of relationships:

EProjectRelationships

This roughly corresponds to the relationships expressed in a POM, given a certain list of active profiles (see above, regarding EProjectFacts).

EProjectGraph

This corresponds to the entire graph of relationships flowing out of a given POM, potentially including all types of relationships for everything in the transitive closure. Graphs can be transformed using filters to achieve more focused results.

EProjectWeb

This is similar to EProjectGraph, but has no single root POM. It merely expresses the interrelationship between a set of projects, and can be thought of as a super-graph of sorts, where EProjectGraph instances may be built by selecting one project in the web and extracting the graph of relationships to that project.