Package org.apache.maven.api.services
Class Sources
java.lang.Object
org.apache.maven.api.services.Sources
Factory methods for creating different types of sources.
This class provides specialized source implementations for different use cases:
- Path sources - simple access to file content
- Build sources - POM files being actively built by Maven
- Resolved sources - POMs resolved from repositories
- Since:
- 4.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic ModelSource
buildSource
(Path path) Creates a new build source for the specified path.static Source
Creates a new source for the specified path.static ModelSource
resolvedSource
(Path path, String location) Creates a new resolved source for the specified path and location.
-
Method Details
-
fromPath
Creates a new source for the specified path.- Parameters:
path
- the path to the file- Returns:
- a new Source instance
- Throws:
NullPointerException
- if path is null
-
buildSource
Creates a new build source for the specified path. Build sources are used for POM files of projects being built by Maven in the filesystem and support resolving related POMs.- Parameters:
path
- the path to the POM file or project directory- Returns:
- a new ModelSource instance configured as a build source
- Throws:
NullPointerException
- if path is null
-
resolvedSource
Creates a new resolved source for the specified path and location. Resolved sources are 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.- Parameters:
path
- the path to the POM file or project directorylocation
- optional logical location of the source, used for reporting purposes- Returns:
- a new ModelSource instance configured as a resolved source
- Throws:
NullPointerException
- if path is null
-