Interface ModelSource

All Superinterfaces:
Source

public interface ModelSource extends Source
Represents a source for loading Maven Project Object Model (POM) files. This interface extends the basic Source interface with specific functionality for handling Maven POM files and resolving related project POMs.

The interface provides two types of sources:

  • Build sources: Used for POM files of projects being built by Maven in the filesystem. These sources support resolving related POMs using the ModelSource.ModelLocator.
  • Resolved sources: Used for artifacts that have been resolved by Maven from repositories (using groupId:artifactId:version coordinates) and downloaded to the local repository. These sources do not support resolving other sources.
Since:
4.0.0
See Also:
  • Method Details

    • resolve

      Resolves a relative path to another POM file using the provided model locator. This method is specifically used to locate POM files for subprojects or related projects referenced from the current POM.

      The resolution process typically involves:

      • Normalizing the relative path for the current platform
      • Resolving the path against the current POM's location
      • Using the model locator to find an existing POM at the resolved location
      Parameters:
      modelLocator - the locator to use for finding the related POM file
      relative - the relative path to resolve
      Returns:
      a new ModelSource for the resolved POM, or null if:
      • This is not a build source
      • No POM can be found at the resolved location
      Throws:
      NullPointerException - if modelLocator or relative is null