Package org.apache.maven.api.spi
Interface ModelParser
- All Superinterfaces:
- SpiService
The 
ModelParser interface is used to locate and read Models from the file system.
 This allows plugging in additional syntaxes for the main model read by Maven when building a project.- Since:
- 4.0.0
- 
Field SummaryFields
- 
Method SummaryModifier and TypeMethodDescriptionLocates the pom in the given directory.locateAndParse(Path dir, Map<String, ?> options) Locate and parse the model in the specified directory.Parse the model obtained previously by a previous call tolocate(Path).
- 
Field Details- 
STRICTOption that can be specified in the options map. The value should be a Boolean.- See Also:
 
 
- 
- 
Method Details- 
locateLocates the pom in the given directory.- Parameters:
- dir- the directory to locate the pom for, never- null
- Returns:
- a Sourcepointing to the located pom or an emptyOptionalif none was found by this parser
 
- 
parse@Nonnull Model parse(@Nonnull Source source, @Nullable Map<String, ?> options) throws ModelParserExceptionParse the model obtained previously by a previous call tolocate(Path).- Parameters:
- source- the source to parse, never- null
- options- possible parsing options, may be- null
- Returns:
- the parsed Model, nevernull
- Throws:
- ModelParserException- if the model cannot be parsed
 
- 
locateAndParse@Nonnull default Optional<Model> locateAndParse(@Nonnull Path dir, @Nullable Map<String, ?> options) throws ModelParserExceptionLocate and parse the model in the specified directory. This is equivalent tolocate(dir).map(s -> parse(s, options)).- Parameters:
- dir- the directory to locate the pom for, never- null
- options- possible parsing options, may be- null
- Returns:
- an optional parsed Modelornullif none could be found
- Throws:
- ModelParserException- if the located model cannot be parsed
 
 
-